40 #pragma GCC system_header
41 #pragma GCC diagnostic ignored "-Wswitch-default"
42 #pragma GCC diagnostic ignored "-Wfloat-equal"
43 #pragma GCC diagnostic ignored "-Wshadow"
45 #ifndef QTTREEPROPERTYBROWSER_H
46 #define QTTREEPROPERTYBROWSER_H
48 #include <QtCore/QModelIndex>
49 #include <QtGui/QTreeWidget>
50 #include <QtGui/QItemDelegate>
53 #if QT_VERSION >= 0x040400
57 class QTreeWidgetItem;
65 : QItemDelegate(parent), m_editorPrivate(0), m_editedItem(0),
66 m_editedWidget(0), m_disablePainting(false)
70 { m_editorPrivate = editorPrivate; }
72 QWidget *
createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
73 const QModelIndex &index)
const;
76 const QStyleOptionViewItem &option,
77 const QModelIndex &index)
const;
79 void paint(QPainter *painter,
const QStyleOptionViewItem &option,
80 const QModelIndex &index)
const;
82 QSize
sizeHint(
const QStyleOptionViewItem &option,
83 const QModelIndex &index)
const;
86 const QModelIndex &)
const {}
93 QTreeWidgetItem *
editedItem()
const {
return m_editedItem; }
97 void drawDecoration(QPainter *painter,
const QStyleOptionViewItem &option,
98 const QRect &rect,
const QPixmap &pixmap)
const;
99 void drawDisplay(QPainter *painter,
const QStyleOptionViewItem &option,
100 const QRect &rect,
const QString &text)
const;
103 void slotEditorDestroyed(QObject *
object);
106 int indentation(
const QModelIndex &index)
const;
108 typedef QMap<QWidget *, QtProperty *> EditorToPropertyMap;
109 mutable EditorToPropertyMap m_editorToProperty;
111 typedef QMap<QtProperty *, QWidget *> PropertyToEditorMap;
112 mutable PropertyToEditorMap m_propertyToEditor;
114 mutable QTreeWidgetItem *m_editedItem;
115 mutable QWidget *m_editedWidget;
116 mutable bool m_disablePainting;
126 { m_editorPrivate = editorPrivate; }
129 {
return itemFromIndex(index); }
134 void drawRow(QPainter *painter,
const QStyleOptionViewItem &option,
135 const QModelIndex &index)
const;
147 Q_PROPERTY(
int indentation READ indentation WRITE setIndentation)
149 bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated)
151 bool alternatingRowColors READ
152 alternatingRowColors WRITE setAlternatingRowColors)
153 Q_PROPERTY(
bool headerVisible READ isHeaderVisible WRITE setHeaderVisible)
154 Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
156 int splitterPosition READ splitterPosition WRITE setSplitterPosition)
158 bool propertiesWithoutValueMarked READ
159 propertiesWithoutValueMarked WRITE setPropertiesWithoutValueMarked)
173 int indentation()
const;
174 void setIndentation(
int i);
176 bool rootIsDecorated()
const;
177 void setRootIsDecorated(
bool show);
179 bool alternatingRowColors()
const;
180 void setAlternatingRowColors(
bool enable);
182 bool isHeaderVisible()
const;
183 void setHeaderVisible(
bool visible);
185 ResizeMode resizeMode()
const;
186 void setResizeMode(ResizeMode mode);
188 int splitterPosition()
const;
189 void setSplitterPosition(
int position);
197 void setBackgroundColor(
QtBrowserItem *item,
const QColor &color);
201 void setPropertiesWithoutValueMarked(
bool mark);
202 bool propertiesWithoutValueMarked()
const;
222 Q_PRIVATE_SLOT(d_func(),
void slotCollapsed(
const QModelIndex &t))
223 Q_PRIVATE_SLOT(d_func(),
void slotExpanded(
const QModelIndex &t))
224 Q_PRIVATE_SLOT(d_func(),
226 Q_PRIVATE_SLOT(d_func(),
227 void slotCurrentTreeItemChanged(
228 QTreeWidgetItem *t, QTreeWidgetItem *t2))
238 void init(QWidget *parent);
243 QWidget *createEditor(
QtProperty *property, QWidget *parent)
const
245 QtProperty *indexToProperty(
const QModelIndex &index)
const;
246 QTreeWidgetItem *indexToItem(
const QModelIndex &index)
const;
247 QtBrowserItem *indexToBrowserItem(
const QModelIndex &index)
const;
248 bool lastColumn(
int column)
const;
249 void disableItem(QTreeWidgetItem *item)
const;
250 void enableItem(QTreeWidgetItem *item)
const;
251 bool hasValue(QTreeWidgetItem *item)
const;
253 void slotCollapsed(
const QModelIndex &index);
254 void slotExpanded(
const QModelIndex &index);
259 bool markPropertiesWithoutValue(
260 )
const {
return m_markPropertiesWithoutValue; }
267 void slotCurrentTreeItemChanged(QTreeWidgetItem *newItem,
270 QTreeWidgetItem *editedItem()
const;
273 void updateItem(QTreeWidgetItem *item);
275 QMap<QtBrowserItem *, QTreeWidgetItem *> m_indexToItem;
276 QMap<QTreeWidgetItem *, QtBrowserItem *> m_itemToIndex;
278 QMap<QtBrowserItem *, QColor> m_indexToBackgroundColor;
282 bool m_headerVisible;
283 QtTreePropertyBrowser::ResizeMode m_resizeMode;
285 bool m_markPropertiesWithoutValue;
286 bool m_browserChangedBlocked;
289 #if QT_VERSION >= 0x040400
Definition: qtpropertybrowser.h:384
virtual void itemChanged(QtBrowserItem *item)=0
void setEditorData(QWidget *, const QModelIndex &) const
Definition: qttreepropertybrowser.h:88
void setEditorPrivate(QtTreePropertyBrowserPrivate *editorPrivate)
Definition: qttreepropertybrowser.h:125
Definition: qtpropertybrowser.h:311
Definition: qttreepropertybrowser.h:142
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
void setEditorPrivate(QtTreePropertyBrowserPrivate *editorPrivate)
Definition: qttreepropertybrowser.h:69
virtual void itemRemoved(QtBrowserItem *item)=0
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: qttreepropertybrowser.h:231
void keyPressEvent(QKeyEvent *event)
void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QPixmap &pixmap) const
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
void mousePressEvent(QMouseEvent *event)
GAZEBO_VISIBLE void enable()
Enable sensors.
Definition: qttreepropertybrowser.h:119
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
void closeEditor(QtProperty *property)
bool eventFilter(QObject *object, QEvent *event)
QtPropertyEditorDelegate(QObject *parent=0)
Definition: qttreepropertybrowser.h:64
QTreeWidgetItem * indexToItem(const QModelIndex &index) const
Definition: qttreepropertybrowser.h:128
QtPropertyEditorView(QWidget *parent=0)
virtual QWidget * createEditor(QtProperty *property, QWidget *parent)
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:68
Definition: qttreepropertybrowser.h:60
void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const
virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem)=0
Definition: qtpropertybrowser.h:77
QTreeWidgetItem * editedItem() const
Definition: qttreepropertybrowser.h:93
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
void setModelData(QWidget *, QAbstractItemModel *, const QModelIndex &) const
Definition: qttreepropertybrowser.h:85