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
qdatawidgetmapper.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 QDATAWIDGETMAPPER_H
5#define QDATAWIDGETMAPPER_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include "QtCore/qobject.h"
9
10QT_REQUIRE_CONFIG(datawidgetmapper);
11
13
16class QModelIndex;
18
19class Q_WIDGETS_EXPORT QDataWidgetMapper: public QObject
20{
22
23 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
24 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
25 Q_PROPERTY(SubmitPolicy submitPolicy READ submitPolicy WRITE setSubmitPolicy)
26
27public:
28 explicit QDataWidgetMapper(QObject *parent = nullptr);
30
33
34 void setItemDelegate(QAbstractItemDelegate *delegate);
35 QAbstractItemDelegate *itemDelegate() const;
36
37 void setRootIndex(const QModelIndex &index);
38 QModelIndex rootIndex() const;
39
40 void setOrientation(Qt::Orientation aOrientation);
41 Qt::Orientation orientation() const;
42
43 enum SubmitPolicy { AutoSubmit, ManualSubmit };
44 Q_ENUM(SubmitPolicy)
45 void setSubmitPolicy(SubmitPolicy policy);
46 SubmitPolicy submitPolicy() const;
47
48 void addMapping(QWidget *widget, int section);
49 void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
50 void removeMapping(QWidget *widget);
51 int mappedSection(QWidget *widget) const;
52 QByteArray mappedPropertyName(QWidget *widget) const;
53 QWidget *mappedWidgetAt(int section) const;
54 void clearMapping();
55
56 int currentIndex() const;
57
58public Q_SLOTS:
59 void revert();
60 bool submit();
61
62 void toFirst();
63 void toLast();
64 void toNext();
65 void toPrevious();
66 virtual void setCurrentIndex(int index);
67 void setCurrentModelIndex(const QModelIndex &index);
68
71
72private:
73 Q_DECLARE_PRIVATE(QDataWidgetMapper)
74 Q_DISABLE_COPY(QDataWidgetMapper)
75};
76
78
79#endif
The QAbstractItemDelegate class is used to display and edit data items from a model.
\inmodule QtCore
Definition qbytearray.h:57
The QDataWidgetMapper class provides mapping between a section of a data model to widgets.
void currentIndexChanged(int index)
This signal is emitted after the current index has changed and all widgets were populated with new da...
SubmitPolicy
This enum describes the possible submit policies a QDataWidgetMapper supports.
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:103
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
Combined button and popup list for selecting options.
Definition qcompare.h:63
GLuint index
[2]
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define explicit
view setModel(model)
[17] //! [18]
QSqlQueryModel * model
[16]
mapper addMapping(mySpinBox, 0)
mapper toFirst()
QSizePolicy policy