Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QSTYLEDITEMDELEGATE_H
6#define QSTYLEDITEMDELEGATE_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qabstractitemdelegate.h>
10#include <QtCore/qstring.h>
11#include <QtGui/qpixmap.h>
12#include <QtCore/qvariant.h>
13
15
16QT_BEGIN_NAMESPACE
17
18class QStyledItemDelegatePrivate;
19class QItemEditorFactory;
20
21class Q_WIDGETS_EXPORT QStyledItemDelegate : public QAbstractItemDelegate
22{
23 Q_OBJECT
24
25public:
26 explicit QStyledItemDelegate(QObject *parent = nullptr);
27 ~QStyledItemDelegate();
28
29 // painting
30 void paint(QPainter *painter,
31 const QStyleOptionViewItem &option, const QModelIndex &index) const override;
32 QSize sizeHint(const QStyleOptionViewItem &option,
33 const QModelIndex &index) const override;
34
35 // editing
36 QWidget *createEditor(QWidget *parent,
37 const QStyleOptionViewItem &option,
38 const QModelIndex &index) const override;
39
40 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
41 void setModelData(QWidget *editor,
42 QAbstractItemModel *model,
43 const QModelIndex &index) const override;
44
45 void updateEditorGeometry(QWidget *editor,
46 const QStyleOptionViewItem &option,
47 const QModelIndex &index) const override;
48
49 // editor factory
50 QItemEditorFactory *itemEditorFactory() const;
51 void setItemEditorFactory(QItemEditorFactory *factory);
52
53 virtual QString displayText(const QVariant &value, const QLocale &locale) const;
54
55protected:
56 virtual void initStyleOption(QStyleOptionViewItem *option,
57 const QModelIndex &index) const;
58
59 bool eventFilter(QObject *object, QEvent *event) override;
60 bool editorEvent(QEvent *event, QAbstractItemModel *model,
61 const QStyleOptionViewItem &option, const QModelIndex &index) override;
62
63private:
64 Q_DECLARE_PRIVATE(QStyledItemDelegate)
65 Q_DISABLE_COPY(QStyledItemDelegate)
66};
67
68QT_END_NAMESPACE
69
70#endif // QSTYLEDITEMDELEGATE_H
The QComboBox widget combines a button with a dropdown list.
Definition qcombobox.h:25
QFileDialogComboBox(QWidget *parent=nullptr)
QStringList history() const
void setHistory(const QStringList &paths)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
void showPopup() override
Displays the list of items in the combobox.
void paintEvent(QPaintEvent *) override
\reimp
void keyPressEvent(QKeyEvent *e) override
FIXME: this is a hack to avoid propagating key press events to the dialog and from there to the "Ok" ...
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
QFileDialogLineEdit(QWidget *parent=nullptr)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
QSize sizeHint() const override
QFileDialogListView(QWidget *parent=nullptr)
void keyPressEvent(QKeyEvent *e) override
void keyPressEvent(QKeyEvent *e) override
QSize sizeHint() const override
QFileDialogTreeView(QWidget *parent)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
The QFileDialog class provides a dialog that allows users to select files or directories.
Definition qfiledialog.h:29
\inmodule QtWidgets
The QListView class provides a list or icon view onto a model.
Definition qlistview.h:18
Definition qlist.h:80
\inmodule QtCore
QSideBarDelegate(QWidget *parent=nullptr)
Definition qsidebar_p.h:35
The QStackedWidget class provides a stack of widgets where only one widget is visible at a time.
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
The QToolButton class provides a quick-access button to commands or options, usually used inside a QT...
Definition qtoolbutton.h:21
The QTreeView class provides a default model/view implementation of a tree view.
Definition qtreeview.h:21
QT_REQUIRE_CONFIG(animation)
static QUrl _qt_get_directory(const QUrl &url, const QFileInfo &local)
static void _qt_init_lastVisited()
QStringList qt_strip_filters(const QStringList &filters)
QStringList qt_make_filter_list(const QString &filter)
static QString fileFromPath(const QString &rootPath, QString path)
static bool isCaseSensitiveFileSystem(const QString &path)
QT_REQUIRE_CONFIG(filedialog)
QT_REQUIRE_CONFIG(thread)
QT_REQUIRE_CONFIG(treeview)
QFileDialogArgs(const QUrl &url={})