Warning, file /include/QtWidgets/qitemdelegate.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QITEMDELEGATE_H
0005 #define QITEMDELEGATE_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qabstractitemdelegate.h>
0009 #include <QtCore/qstring.h>
0010 #include <QtGui/qpixmap.h>
0011 #include <QtCore/qvariant.h>
0012
0013 QT_REQUIRE_CONFIG(itemviews);
0014
0015 QT_BEGIN_NAMESPACE
0016
0017 class QItemDelegatePrivate;
0018 class QItemEditorFactory;
0019
0020 class Q_WIDGETS_EXPORT QItemDelegate : public QAbstractItemDelegate
0021 {
0022 Q_OBJECT
0023 Q_PROPERTY(bool clipping READ hasClipping WRITE setClipping)
0024
0025 public:
0026 explicit QItemDelegate(QObject *parent = nullptr);
0027 ~QItemDelegate();
0028
0029 bool hasClipping() const;
0030 void setClipping(bool clip);
0031
0032
0033 void paint(QPainter *painter,
0034 const QStyleOptionViewItem &option,
0035 const QModelIndex &index) const override;
0036 QSize sizeHint(const QStyleOptionViewItem &option,
0037 const QModelIndex &index) const override;
0038
0039
0040 QWidget *createEditor(QWidget *parent,
0041 const QStyleOptionViewItem &option,
0042 const QModelIndex &index) const override;
0043
0044 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
0045 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
0046
0047 void updateEditorGeometry(QWidget *editor,
0048 const QStyleOptionViewItem &option,
0049 const QModelIndex &index) const override;
0050
0051
0052 QItemEditorFactory *itemEditorFactory() const;
0053 void setItemEditorFactory(QItemEditorFactory *factory);
0054
0055 protected:
0056 virtual void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option,
0057 const QRect &rect, const QString &text) const;
0058 virtual void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option,
0059 const QRect &rect, const QPixmap &pixmap) const;
0060 virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option,
0061 const QRect &rect) const;
0062 virtual void drawCheck(QPainter *painter, const QStyleOptionViewItem &option,
0063 const QRect &rect, Qt::CheckState state) const;
0064 void drawBackground(QPainter *painter, const QStyleOptionViewItem &option,
0065 const QModelIndex &index) const;
0066
0067 void doLayout(const QStyleOptionViewItem &option,
0068 QRect *checkRect, QRect *iconRect, QRect *textRect, bool hint) const;
0069
0070 QRect rect(const QStyleOptionViewItem &option, const QModelIndex &index, int role) const;
0071
0072 bool eventFilter(QObject *object, QEvent *event) override;
0073 bool editorEvent(QEvent *event, QAbstractItemModel *model,
0074 const QStyleOptionViewItem &option, const QModelIndex &index) override;
0075
0076 QStyleOptionViewItem setOptions(const QModelIndex &index,
0077 const QStyleOptionViewItem &option) const;
0078
0079 QPixmap decoration(const QStyleOptionViewItem &option, const QVariant &variant) const;
0080
0081 static QPixmap selectedPixmap(const QPixmap &pixmap, const QPalette &palette, bool enabled);
0082
0083 QRect doCheck(const QStyleOptionViewItem &option, const QRect &bounding,
0084 const QVariant &variant) const;
0085 QRect textRectangle(QPainter *painter, const QRect &rect,
0086 const QFont &font, const QString &text) const;
0087
0088 private:
0089 Q_DECLARE_PRIVATE(QItemDelegate)
0090 Q_DISABLE_COPY(QItemDelegate)
0091 };
0092
0093 QT_END_NAMESPACE
0094
0095 #endif