Go to
the documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QSTYLEDITEMDELEGATE_H
00043 #define QSTYLEDITEMDELEGATE_H
00044
00045 #include <QtGui/qabstractitemdelegate.h>
00046 #include <QtCore/qstring.h>
00047 #include <QtGui/qpixmap.h>
00048 #include <QtCore/qvariant.h>
00049
00050 QT_BEGIN_HEADER
00051
00052 QT_BEGIN_NAMESPACE
00053
00054 QT_MODULE(Gui)
00055
00056 #ifndef QT_NO_ITEMVIEWS
00057
00058 class QStyledItemDelegatePrivate;
00059 class QItemEditorFactory;
00060
00061 class Q_GUI_EXPORT QStyledItemDelegate : public QAbstractItemDelegate
00062 {
00063 Q_OBJECT
00064
00065 public:
00066 explicit QStyledItemDelegate(QObject *parent = 0);
00067 ~QStyledItemDelegate();
00068
00069
00070 void paint(QPainter *painter,
00071 const QStyleOptionViewItem &option, const QModelIndex &index) const;
00072 QSize sizeHint(const QStyleOptionViewItem &option,
00073 const QModelIndex &index) const;
00074
00075
00076 QWidget *createEditor(QWidget *parent,
00077 const QStyleOptionViewItem &option,
00078 const QModelIndex &index) const;
00079
00080 void setEditorData(QWidget *editor, const QModelIndex &index) const;
00081 void setModelData(QWidget *editor,
00082 QAbstractItemModel *model,
00083 const QModelIndex &index) const;
00084
00085 void updateEditorGeometry(QWidget *editor,
00086 const QStyleOptionViewItem &option,
00087 const QModelIndex &index) const;
00088
00089
00090 QItemEditorFactory *itemEditorFactory() const;
00091 void setItemEditorFactory(QItemEditorFactory *factory);
00092
00093 virtual QString displayText(const QVariant &value, const QLocale &locale) const;
00094
00095 protected:
00096 virtual void initStyleOption(QStyleOptionViewItem *option,
00097 const QModelIndex &index) const;
00098
00099 bool eventFilter(QObject *object, QEvent *event);
00100 bool editorEvent(QEvent *event, QAbstractItemModel *model,
00101 const QStyleOptionViewItem &option, const QModelIndex &index);
00102
00103 private:
00104 Q_DECLARE_PRIVATE(QStyledItemDelegate)
00105 Q_DISABLE_COPY(QStyledItemDelegate)
00106
00107 Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*))
00108 };
00109
00110 #endif // QT_NO_ITEMVIEWS
00111
00112 QT_END_NAMESPACE
00113
00114 QT_END_HEADER
00115
00116 #endif // QSTYLEDITEMDELEGATE_H