19 #ifndef INC_C4ConsoleQtPropListViewer
20 #define INC_C4ConsoleQtPropListViewer
30 class C4ConsoleQtPropListModel;
31 struct C4ConsoleQtPropListModelProperty;
33 class C4PropertyDelegate :
public QObject
38 const class C4PropertyDelegateFactory *factory;
45 C4PropertyDelegate(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
46 ~C4PropertyDelegate()
override =
default;
48 virtual void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const {};
49 virtual void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const {};
50 virtual QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const = 0;
51 virtual void UpdateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option)
const;
52 virtual bool GetPropertyValue(
const C4Value &container,
C4String *key, int32_t index,
C4Value *out_val)
const;
53 virtual bool GetPropertyValueBase(
const C4Value &container,
C4String *key, int32_t index,
C4Value *out_val)
const;
54 virtual QString GetDisplayString(
const C4Value &val,
class C4Object *obj,
bool short_names)
const;
55 virtual QColor GetDisplayTextColor(
const C4Value &val,
class C4Object *obj)
const;
56 virtual QColor GetDisplayBackgroundColor(
const C4Value &val,
class C4Object *obj)
const;
57 const char *GetSetFunction()
const {
return set_function.
Get() ? set_function->
GetCStr() :
nullptr; }
58 virtual const class C4PropertyDelegateShape *GetShapeDelegate(
C4Value &val,
C4PropertyPath *shape_path)
const {
return nullptr; }
59 virtual const class C4PropertyDelegateShape *GetDirectShapeDelegate()
const {
return nullptr; }
60 const char *GetUpdateCallback()
const {
return update_callback ? update_callback->
GetCStr() :
nullptr; }
61 virtual bool HasCustomPaint()
const {
return false; }
62 virtual bool Paint(QPainter *painter,
const QStyleOptionViewItem &option,
const C4Value &val)
const {
return false; }
63 virtual C4PropertyPath GetPathForProperty(
struct C4ConsoleQtPropListModelProperty *editor_prop)
const;
66 const C4Value &GetCreationProps()
const {
return creation_props; }
67 virtual bool IsPasteValid(
const C4Value &val)
const = 0;
70 void EditorValueChangedSignal(QWidget *editor)
const;
71 void EditingDoneSignal(QWidget *editor)
const;
74 class C4PropertyDelegateInt :
public C4PropertyDelegate
77 int32_t min, max, step;
79 C4PropertyDelegateInt(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
81 void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
82 void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const override;
83 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
84 bool IsPasteValid(
const C4Value &val)
const override;
87 class C4PropertyDelegateStringEditor :
public QWidget
92 QPushButton *localization_button;
93 bool text_edited, commit_pending;
97 std::unique_ptr<class C4ConsoleQtLocalizeStringDlg> localization_dialogue;
99 void OpenLocalizationDialogue();
100 void CloseLocalizationDialogue();
101 void StoreEditedText();
103 C4PropertyDelegateStringEditor(QWidget *parent,
bool has_localization_button);
104 void SetValue(
const C4Value &val);
106 bool IsCommitPending()
const {
return commit_pending; }
107 void SetCommitPending(
bool to_val) { commit_pending = to_val; }
109 void EditingDoneSignal()
const;
112 class C4PropertyDelegateString :
public C4PropertyDelegate
117 typedef C4PropertyDelegateStringEditor Editor;
119 C4PropertyDelegateString(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
121 void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
122 void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const override;
123 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
124 QString GetDisplayString(
const C4Value &v,
C4Object *obj,
bool short_names)
const override;
125 bool IsPasteValid(
const C4Value &val)
const override;
129 class C4PropertyDelegateLabelAndButtonWidget :
public QWidget
141 C4PropertyDelegateLabelAndButtonWidget(QWidget *parent);
144 class C4PropertyDelegateDescendPath :
public C4PropertyDelegate
148 bool edit_on_selection;
151 typedef C4PropertyDelegateLabelAndButtonWidget Editor;
153 C4PropertyDelegateDescendPath(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
155 void SetEditorData(QWidget *aeditor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
156 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
159 class C4PropertyDelegateArray :
public C4PropertyDelegateDescendPath
162 int32_t max_array_display;
163 mutable C4PropertyDelegate *element_delegate;
165 void ResolveElementDelegate()
const;
167 C4PropertyDelegateArray(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
169 QString GetDisplayString(
const C4Value &v,
C4Object *obj,
bool short_names)
const override;
170 bool IsPasteValid(
const C4Value &val)
const override;
173 class C4PropertyDelegatePropList :
public C4PropertyDelegateDescendPath
178 C4PropertyDelegatePropList(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
180 QString GetDisplayString(
const C4Value &v,
C4Object *obj,
bool short_names)
const override;
181 bool IsPasteValid(
const C4Value &val)
const override;
184 class C4PropertyDelegateEffectEditor :
public QWidget
190 QPushButton *remove_button, *edit_button;
193 C4PropertyDelegateEffectEditor(QWidget *parent);
196 class C4PropertyDelegateEffect :
public C4PropertyDelegate
199 typedef C4PropertyDelegateEffectEditor Editor;
201 C4PropertyDelegateEffect(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
203 void SetEditorData(QWidget *aeditor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
204 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
205 QString GetDisplayString(
const C4Value &v,
C4Object *obj,
bool short_names)
const override;
206 bool IsPasteValid(
const C4Value &val)
const override {
return false; }
207 bool GetPropertyValue(
const C4Value &container,
C4String *key, int32_t index,
C4Value *out_val)
const override;
208 C4PropertyPath GetPathForProperty(C4ConsoleQtPropListModelProperty *editor_prop)
const override;
211 class C4PropertyDelegateColor :
public C4PropertyDelegate
217 typedef C4PropertyDelegateLabelAndButtonWidget Editor;
219 C4PropertyDelegateColor(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
221 void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
222 void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const override;
223 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
224 QString GetDisplayString(
const C4Value &v,
C4Object *obj,
bool short_names)
const override;
225 QColor GetDisplayTextColor(
const C4Value &val,
class C4Object *obj)
const override;
226 QColor GetDisplayBackgroundColor(
const C4Value &val,
class C4Object *obj)
const override;
227 bool IsPasteValid(
const C4Value &val)
const override;
230 void OpenColorDialogue(Editor *editor)
const;
234 class C4StyledItemDelegateWithButton :
public QStyledItemDelegate
245 C4StyledItemDelegateWithButton(ButtonType bt) : button_type(bt) { }
248 bool editorEvent(QEvent *event, QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index)
override;
250 void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
255 class C4DeepQComboBox :
public QComboBox
259 bool editable, manual_text_edited;
260 QString last_edited_text;
261 bool is_next_close_blocked;
262 int last_popup_height;
263 std::unique_ptr<C4StyledItemDelegateWithButton> item_delegate;
264 QSize default_icon_size;
269 OptionIndexRole = Qt::UserRole + 1,
270 ObjectHighlightRole = Qt::UserRole + 2,
271 ValueStringRole = Qt::UserRole + 3,
272 PriorityNameSortRole = Qt::UserRole + 4,
275 C4DeepQComboBox(QWidget *parent, C4StyledItemDelegateWithButton::ButtonType button_type,
bool editable);
277 void showPopup()
override;
278 void hidePopup()
override;
280 void setCurrentModelIndex(QModelIndex new_index);
281 int32_t GetCurrentSelectionIndex();
282 void BlockNextCloseEvent() { is_next_close_blocked =
true; };
285 void doShowPopup() { showPopup(); }
288 void NewItemSelected(int32_t new_item);
289 void TextChanged(
const QString &new_text);
293 bool eventFilter(QObject *obj, QEvent *event)
override;
297 class C4PropertyDelegateEnumEditor :
public QWidget
302 enum { INDEX_Custom_Value = -1 };
305 int32_t last_selection_index;
307 C4DeepQComboBox *option_box;
309 QWidget *parameter_widget;
310 bool updating, option_changed, dropdown_pending;
311 const C4PropertyDelegate *paint_parameter_delegate;
313 C4PropertyDelegateEnumEditor(QWidget *parent)
314 : QWidget(parent), last_selection_index(-1), option_box(nullptr), layout(nullptr), parameter_widget(nullptr),
315 updating(false), option_changed(false), dropdown_pending(false), paint_parameter_delegate(nullptr) { }
317 void paintEvent(QPaintEvent *)
override;
320 class C4PropertyDelegateEnum :
public C4PropertyDelegate
325 typedef C4PropertyDelegateEnumEditor Editor;
340 bool force_serialization{
false};
342 mutable C4PropertyDelegate *adelegate{
nullptr};
350 } storage_type{StorageNone};
357 virtual C4StyledItemDelegateWithButton::ButtonType GetOptionComboBoxButtonType()
const {
return C4StyledItemDelegateWithButton::BT_Help; }
360 std::vector<Option> options;
361 Option default_option;
370 void ReserveOptions(int32_t num);
371 QStandardItemModel *CreateOptionModel()
const;
373 C4PropertyDelegateEnum(
const class C4PropertyDelegateFactory *factory,
C4PropList *props,
const C4ValueArray *poptions=
nullptr);
378 void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
379 void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const override;
380 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
381 QString GetDisplayString(
const C4Value &val,
class C4Object *obj,
bool short_names)
const override;
382 const class C4PropertyDelegateShape *GetShapeDelegate(
C4Value &val,
C4PropertyPath *shape_path)
const override;
383 bool HasCustomPaint()
const override {
return true; }
384 bool Paint(QPainter *painter,
const QStyleOptionViewItem &option,
const C4Value &val)
const override;
385 bool IsPasteValid(
const C4Value &val)
const override;
388 QModelIndex GetModelIndexByID(QStandardItemModel *model, QStandardItem *parent_item, int32_t
id,
const QModelIndex &parent)
const;
389 int32_t GetOptionByValue(
const C4Value &val)
const;
390 void UpdateEditorParameter(C4PropertyDelegateEnum::Editor *editor,
bool by_selection)
const;
391 void EnsureOptionDelegateResolved(
const Option &option)
const;
392 void SetOptionValue(
const C4PropertyPath &use_path,
const C4PropertyDelegateEnum::Option &option,
const C4Value &option_value)
const;
393 void UpdateOptionIndex(Editor *editor,
int idx,
const QString *custom_text)
const;
397 class C4PropertyDelegateDef :
public C4PropertyDelegateEnum
402 C4PropertyDelegateDef(
const C4PropertyDelegateFactory *factory,
C4PropList *props);
403 bool IsPasteValid(
const C4Value &val)
const override;
406 void AddDefinitions(
class C4ConsoleQtDefinitionListModel *def_list_model, QModelIndex parent,
C4String *group);
410 class C4PropertyDelegateObject :
public C4PropertyDelegateEnum
414 size_t max_nearby_objects;
417 void UpdateObjectList();
419 C4PropertyDelegateObject(
const C4PropertyDelegateFactory *factory,
C4PropList *props);
421 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
422 QString GetDisplayString(
const C4Value &v,
class C4Object *obj,
bool short_names)
const override;
423 bool IsPasteValid(
const C4Value &val)
const override;
427 class C4PropertyDelegateSound :
public C4PropertyDelegateEnum
430 C4PropertyDelegateSound(
const C4PropertyDelegateFactory *factory,
C4PropList *props);
431 QString GetDisplayString(
const C4Value &v,
class C4Object *obj,
bool short_names)
const override;
432 bool IsPasteValid(
const C4Value &val)
const override;
434 C4StyledItemDelegateWithButton::ButtonType GetOptionComboBoxButtonType()
const override {
return C4StyledItemDelegateWithButton::BT_PlaySound; }
438 class C4PropertyDelegateBool :
public C4PropertyDelegateEnum
441 C4PropertyDelegateBool(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
443 bool GetPropertyValue(
const C4Value &container,
C4String *key, int32_t index,
C4Value *out_val)
const override;
444 bool IsPasteValid(
const C4Value &val)
const override;
448 class C4PropertyDelegateHasEffect :
public C4PropertyDelegateBool
453 C4PropertyDelegateHasEffect(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
455 bool GetPropertyValue(
const C4Value &container,
C4String *key, int32_t index,
C4Value *out_val)
const override;
459 class C4PropertyDelegateC4ValueEnum :
public C4PropertyDelegateEnum
462 C4PropertyDelegateC4ValueEnum(
const C4PropertyDelegateFactory *factory,
C4PropList *props);
463 bool IsPasteValid(
const C4Value &val)
const override {
return true; }
466 class C4PropertyDelegateC4ValueInputEditor :
public QWidget
473 QPushButton *extended_button;
477 C4PropertyDelegateC4ValueInputEditor(QWidget *parent);
481 class C4PropertyDelegateC4ValueInput :
public C4PropertyDelegate
484 typedef C4PropertyDelegateC4ValueInputEditor Editor;
486 C4PropertyDelegateC4ValueInput(
const C4PropertyDelegateFactory *factory,
C4PropList *props) : C4PropertyDelegate(factory, props) { }
488 void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const override;
489 void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const override;
490 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override;
491 bool IsPasteValid(
const C4Value &val)
const override {
return true; }
495 class C4PropertyDelegateShape :
public C4PropertyDelegate
499 virtual void DoPaint(QPainter *painter,
const QRect &inner_rect)
const = 0;
501 C4PropertyDelegateShape(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
502 void SetEditorData(QWidget *editor,
const C4Value &val,
const C4PropertyPath &property_path)
const override { }
503 void SetModelData(QObject *editor,
const C4PropertyPath &property_path,
class C4ConsoleQtShape *prop_shape)
const override;
504 QWidget *CreateEditor(
const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent,
const QStyleOptionViewItem &option,
bool by_selection,
bool is_child)
const override {
return nullptr; }
505 const C4PropertyDelegateShape *GetShapeDelegate(
C4Value &val,
C4PropertyPath *shape_path)
const override {
return this; }
506 const C4PropertyDelegateShape *GetDirectShapeDelegate()
const override {
return this; }
507 bool HasCustomPaint()
const override {
return true; }
508 bool Paint(QPainter *painter,
const QStyleOptionViewItem &option,
const C4Value &val)
const override;
509 QString GetDisplayString(
const C4Value &v,
class C4Object *obj,
bool short_names)
const override {
return QString(); }
511 virtual void ConnectSignals(C4ConsoleQtShape *shape,
const C4PropertyPath &property_path)
const;
514 class C4PropertyDelegateRect :
public C4PropertyDelegateShape
518 void DoPaint(QPainter *painter,
const QRect &inner_rect)
const override;
520 C4PropertyDelegateRect(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
521 bool IsPasteValid(
const C4Value &val)
const override;
524 class C4PropertyDelegateCircle :
public C4PropertyDelegateShape
526 bool can_move_center;
528 void DoPaint(QPainter *painter,
const QRect &inner_rect)
const override;
530 C4PropertyDelegateCircle(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
531 bool IsPasteValid(
const C4Value &val)
const override;
534 class C4PropertyDelegatePoint :
public C4PropertyDelegateShape
536 bool horizontal_fix{
false };
537 bool vertical_fix{
false };
539 void DoPaint(QPainter *painter,
const QRect &inner_rect)
const override;
541 C4PropertyDelegatePoint(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
542 bool IsPasteValid(
const C4Value &val)
const override;
545 class C4PropertyDelegateGraph :
public C4PropertyDelegateShape
547 bool horizontal_fix =
false;
548 bool vertical_fix =
false;
549 bool structure_fix =
false;
551 void DoPaint(QPainter *painter,
const QRect &inner_rect)
const override;
553 bool IsVertexPasteValid(
const C4Value &val)
const;
554 bool IsEdgePasteValid(
const C4Value &val)
const;
556 C4PropertyDelegateGraph(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
557 bool IsPasteValid(
const C4Value &val)
const override;
559 void ConnectSignals(C4ConsoleQtShape *shape,
const C4PropertyPath &property_path)
const override;
562 class C4PropertyDelegatePolyline :
public C4PropertyDelegateGraph
564 void DoPaint(QPainter *painter,
const QRect &inner_rect)
const override;
566 C4PropertyDelegatePolyline(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
567 bool IsPasteValid(
const C4Value &val)
const override;
570 class C4PropertyDelegatePolygon :
public C4PropertyDelegateGraph
572 void DoPaint(QPainter *painter,
const QRect &inner_rect)
const override;
574 C4PropertyDelegatePolygon(
const class C4PropertyDelegateFactory *factory,
C4PropList *props);
575 bool IsPasteValid(
const C4Value &val)
const override;
578 class C4PropertyDelegateFactory :
public QStyledItemDelegate
582 mutable std::map<C4PropList *, std::unique_ptr<C4PropertyDelegate> > delegates;
583 mutable C4PropertyDelegateEffect effect_delegate;
584 mutable QWidget *current_editor{
nullptr};
585 mutable C4PropertyDelegate *current_editor_delegate;
586 mutable C4Value last_edited_value;
587 class C4ConsoleQtPropListModel *property_model{
nullptr};
588 class C4ConsoleQtDefinitionListModel *def_list_model;
590 C4PropertyDelegate *CreateDelegateByPropList(
C4PropList *props)
const;
591 C4PropertyDelegate *GetDelegateByIndex(
const QModelIndex &index)
const;
593 C4PropertyDelegateFactory();
594 ~C4PropertyDelegateFactory()
override =
default;
596 C4PropertyDelegate *GetDelegateByValue(
const C4Value &val)
const;
597 C4PropertyDelegateEffect *GetEffectDelegate()
const {
return &effect_delegate; }
599 void ClearDelegates();
600 void SetPropertyData(
const C4PropertyDelegate *d, QObject *editor, C4ConsoleQtPropListModelProperty *editor_prop)
const;
601 void SetPropertyModel(
class C4ConsoleQtPropListModel *new_property_model) { property_model = new_property_model; }
602 void SetDefinitionListModel(
class C4ConsoleQtDefinitionListModel *new_def_list_model) { def_list_model = new_def_list_model; }
603 class C4ConsoleQtDefinitionListModel *GetDefinitionListModel()
const {
return def_list_model; }
604 class C4ConsoleQtPropListModel *GetPropertyModel()
const {
return property_model; }
605 void OnPropListChanged();
606 bool CheckCurrentEditor(C4PropertyDelegate *d, QWidget *editor)
const;
609 void EditorValueChanged(QWidget *editor);
610 void EditingDone(QWidget *editor);
611 void CopyToClipboard(
const QModelIndex &index);
612 bool PasteFromClipboard(
const QModelIndex &index,
bool check_only);
616 void setEditorData(QWidget *editor,
const QModelIndex &index)
const override;
617 void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index)
const override;
618 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
619 void destroyEditor(QWidget *editor,
const QModelIndex &index)
const override;
620 void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
621 QSize sizeHint(
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
622 void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
623 bool editorEvent(QEvent *event, QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index)
override;
628 class C4PropertyNameDelegate :
public C4StyledItemDelegateWithButton
632 class C4ConsoleQtPropListModel *property_model{
nullptr};
635 C4PropertyNameDelegate() : C4StyledItemDelegateWithButton(C4StyledItemDelegateWithButton::BT_Help) { }
637 void SetPropertyModel(
class C4ConsoleQtPropListModel *new_property_model) { property_model = new_property_model; }
641 struct C4ConsoleQtPropListModelProperty
649 C4PropertyDelegate *delegate{
nullptr};
650 bool about_to_edit{
false};
654 int32_t group_idx{-1};
657 C4ConsoleQtShapeHolder *shape;
658 const C4PropertyDelegate *shape_delegate{
nullptr};
661 C4ConsoleQtPropListModelProperty() =
default;
665 class C4ConsoleQtPropListModel :
public QAbstractItemModel
670 typedef C4ConsoleQtPropListModelProperty Property;
674 std::vector<Property> props;
676 struct TargetStackEntry
684 : path(path), value(value), info_proplist(info_proplist) {}
689 int32_t major_index, minor_index;
696 std::list<TargetStackEntry> target_path_stack;
697 std::vector<PropertyGroup> property_groups;
698 QFont header_font, important_property_font;
699 C4PropertyDelegateFactory *delegate_factory;
700 QItemSelectionModel *selection_model;
702 std::map<std::string, C4ConsoleQtShapeHolder> shapes;
704 C4ConsoleQtPropListModel(C4PropertyDelegateFactory *delegate_factory);
705 ~C4ConsoleQtPropListModel()
override;
707 void SetSelectionModel(QItemSelectionModel *m) { selection_model = m; }
708 QItemSelectionModel *GetSelectionModel()
const {
return selection_model; }
711 bool AddEffectGroup(int32_t group_index,
C4Object *base_object);
712 void SetBasePropList(
C4PropList *new_proplist);
715 void UpdateValue(
bool select_default);
716 void DoOnUpdateCall(
const C4PropertyPath &updated_path,
const C4PropertyDelegate *delegate);
719 int32_t UpdateValuePropList(
C4PropList *target_proplist, int32_t *default_selection_group, int32_t *default_selection_index);
720 int32_t UpdateValueArray(
C4ValueArray *target_array, int32_t *default_selection_group, int32_t *default_selection_index);
723 void ProplistChanged(int32_t major_sel, int32_t minor_sel)
const;
726 void UpdateSelection(int32_t major_sel, int32_t minor_sel)
const;
732 int32_t GetTargetPathStackSize()
const {
return target_path_stack.size(); }
733 const char *GetTargetPathText()
const {
return target_path.
GetGetPath(); }
734 QString GetTargetPathHelp()
const;
735 const char *GetTargetPathName()
const;
736 bool IsArray()
const {
return !!target_value.
getArray(); }
737 void AddArrayElement();
738 void RemoveArrayElement();
739 bool IsTargetReadonly()
const;
740 C4ConsoleQtPropListModel::Property *GetPropByIndex(
const QModelIndex &index)
const;
741 class C4ConsoleQtShape *GetShapeByPropertyPath(
const char *property_path);
744 int rowCount(
const QModelIndex & parent = QModelIndex())
const override;
745 int columnCount(
const QModelIndex & parent = QModelIndex())
const override;
746 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
747 QVariant data(
const QModelIndex & index,
int role = Qt::DisplayRole)
const override;
748 QModelIndex index(
int row,
int column,
const QModelIndex &parent)
const override;
749 QModelIndex parent(
const QModelIndex &index)
const override;
750 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
751 Qt::DropActions supportedDropActions()
const override;
752 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent)
override;
753 QStringList mimeTypes()
const override;
754 QMimeData *mimeData(
const QModelIndexList &indexes)
const override;
const char * GetGetPath() const
const char * GetCStr() const
C4ValueArray * getArray() const
C4PropList * getPropList() const