Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstyleditemdelegate.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSTYLEDITEMDELEGATE_H
5#define QSTYLEDITEMDELEGATE_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractitemdelegate.h>
9#include <QtCore/qstring.h>
10#include <QtGui/qpixmap.h>
11#include <QtCore/qvariant.h>
12
14
16
19
20class Q_WIDGETS_EXPORT QStyledItemDelegate : public QAbstractItemDelegate
21{
23
24public:
25 explicit QStyledItemDelegate(QObject *parent = nullptr);
27
28 // painting
30 const QStyleOptionViewItem &option, const QModelIndex &index) const override;
31 QSize sizeHint(const QStyleOptionViewItem &option,
32 const QModelIndex &index) const override;
33
34 // editing
35 QWidget *createEditor(QWidget *parent,
36 const QStyleOptionViewItem &option,
37 const QModelIndex &index) const override;
38
39 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
40 void setModelData(QWidget *editor,
42 const QModelIndex &index) const override;
43
44 void updateEditorGeometry(QWidget *editor,
45 const QStyleOptionViewItem &option,
46 const QModelIndex &index) const override;
47
48 // editor factory
49 QItemEditorFactory *itemEditorFactory() const;
50 void setItemEditorFactory(QItemEditorFactory *factory);
51
52 virtual QString displayText(const QVariant &value, const QLocale &locale) const;
53
54protected:
55 virtual void initStyleOption(QStyleOptionViewItem *option,
56 const QModelIndex &index) const;
57
58 bool eventFilter(QObject *object, QEvent *event) override;
59 bool editorEvent(QEvent *event, QAbstractItemModel *model,
60 const QStyleOptionViewItem &option, const QModelIndex &index) override;
61
62private:
63 Q_DECLARE_PRIVATE(QStyledItemDelegate)
64 Q_DISABLE_COPY(QStyledItemDelegate)
65};
66
68
69#endif // QSTYLEDITEMDELEGATE_H
The QAbstractItemDelegate class is used to display and edit data items from a model.
\inmodule QtCore
Definition qcoreevent.h:45
The QItemEditorFactory class provides widgets for editing item data in views and delegates.
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:103
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
\inmodule QtCore
Definition qvariant.h:65
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QPainter paint
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
struct _cl_event * event
GLuint GLenum option
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
QSqlQueryModel * model
[16]
QItemEditorFactory * factory
QPainter painter(this)
[7]