Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:23:33

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QDATAWIDGETMAPPER_H
0006 #define QDATAWIDGETMAPPER_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 
0010 #include <QtCore/qobject.h>
0011 
0012 QT_REQUIRE_CONFIG(datawidgetmapper);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QAbstractItemDelegate;
0017 class QAbstractItemModel;
0018 class QModelIndex;
0019 class QDataWidgetMapperPrivate;
0020 
0021 class Q_WIDGETS_EXPORT QDataWidgetMapper: public QObject
0022 {
0023     Q_OBJECT
0024 
0025     Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
0026     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
0027     Q_PROPERTY(SubmitPolicy submitPolicy READ submitPolicy WRITE setSubmitPolicy)
0028 
0029 public:
0030     explicit QDataWidgetMapper(QObject *parent = nullptr);
0031     ~QDataWidgetMapper();
0032 
0033     void setModel(QAbstractItemModel *model);
0034     QAbstractItemModel *model() const;
0035 
0036     void setItemDelegate(QAbstractItemDelegate *delegate);
0037     QAbstractItemDelegate *itemDelegate() const;
0038 
0039     void setRootIndex(const QModelIndex &index);
0040     QModelIndex rootIndex() const;
0041 
0042     void setOrientation(Qt::Orientation aOrientation);
0043     Qt::Orientation orientation() const;
0044 
0045     enum SubmitPolicy { AutoSubmit, ManualSubmit };
0046     Q_ENUM(SubmitPolicy)
0047     void setSubmitPolicy(SubmitPolicy policy);
0048     SubmitPolicy submitPolicy() const;
0049 
0050     void addMapping(QWidget *widget, int section);
0051     void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
0052     void removeMapping(QWidget *widget);
0053     int mappedSection(QWidget *widget) const;
0054     QByteArray mappedPropertyName(QWidget *widget) const;
0055     QWidget *mappedWidgetAt(int section) const;
0056     void clearMapping();
0057 
0058     int currentIndex() const;
0059 
0060 public Q_SLOTS:
0061     void revert();
0062     bool submit();
0063 
0064     void toFirst();
0065     void toLast();
0066     void toNext();
0067     void toPrevious();
0068     virtual void setCurrentIndex(int index);
0069     void setCurrentModelIndex(const QModelIndex &index);
0070 
0071 Q_SIGNALS:
0072     void currentIndexChanged(int index);
0073 
0074 private:
0075     Q_DECLARE_PRIVATE(QDataWidgetMapper)
0076     Q_DISABLE_COPY(QDataWidgetMapper)
0077 };
0078 
0079 QT_END_NAMESPACE
0080 
0081 #endif