File indexing completed on 2024-04-28 03:51:18
0001 /*. 0002 SPDX-FileCopyrightText: 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef STEP_PROPERTIESBROWSER_H 0008 #define STEP_PROPERTIESBROWSER_H 0009 0010 #include <QDockWidget> 0011 #include <QItemDelegate> 0012 0013 class PropertiesBrowserModel; 0014 class WorldModel; 0015 class QModelIndex; 0016 class QAbstractItemModel; 0017 class KComboBox; 0018 class KColorButton; 0019 class QLineEdit; 0020 0021 class PropertiesBrowserDelegate: public QItemDelegate 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit PropertiesBrowserDelegate(QObject* parent = nullptr): 0026 QItemDelegate(parent), _editor(nullptr), _updating(false) {} 0027 QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, 0028 const QModelIndex& index) const override; 0029 void setEditorData(QWidget* editor, const QModelIndex& index) const override; 0030 void setModelData(QWidget* editor, QAbstractItemModel* model, 0031 const QModelIndex& index) const override; 0032 protected slots: 0033 void editorActivated(); 0034 0035 protected: 0036 enum { SolverChoiser, ColorChoiser, 0037 BoolChoiser, Standard } _editorType; 0038 QWidget* _editor; 0039 KComboBox* _comboBox; 0040 KColorButton* _colorButton; 0041 QLineEdit* _lineEdit; 0042 mutable bool _updating; 0043 }; 0044 0045 class PropertiesBrowserView; 0046 class PropertiesBrowser: public QDockWidget 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 explicit PropertiesBrowser(WorldModel* worldModel, QWidget* parent = nullptr); 0052 0053 public slots: 0054 void settingsChanged(); 0055 0056 protected slots: 0057 void worldModelReset(); 0058 void worldDataChanged(bool dynamicOnly); 0059 void worldCurrentChanged(const QModelIndex& current, const QModelIndex& previous); 0060 void worldRowsRemoved(const QModelIndex& parent, int start, int end); 0061 0062 void currentChanged(const QModelIndex& current, const QModelIndex& previous); 0063 void rowsInserted(const QModelIndex& parent, int start, int end); 0064 void rowsRemoved(const QModelIndex& parent, int start, int end); 0065 0066 protected: 0067 bool eventFilter(QObject* object, QEvent* event) override; 0068 0069 WorldModel* _worldModel; 0070 PropertiesBrowserModel* _propertiesBrowserModel; 0071 PropertiesBrowserView* _treeView; 0072 }; 0073 0074 #endif 0075