QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsfieldproxymodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfieldproxymodel.h
3 --------------------------------------
4 Date : 01.04.2014
5 Copyright : (C) 2014 Denis Rouzaud
7***************************************************************************
8* *
9* This program is free software; you can redistribute it and/or modify *
10* it under the terms of the GNU General Public License as published by *
11* the Free Software Foundation; either version 2 of the License, or *
12* (at your option) any later version. *
13* *
14***************************************************************************/
15
16#ifndef QGSFIELDPROXYMODEL_H
17#define QGSFIELDPROXYMODEL_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21
22#include <QSortFilterProxyModel>
23
24class QgsFieldModel;
25
30class CORE_EXPORT QgsFieldProxyModel : public QSortFilterProxyModel
31{
32 Q_OBJECT
33
34 public:
35
37 enum Filter SIP_ENUM_BASETYPE( IntFlag )
38 {
39 String = 1 << 0,
40 Int = 1 << 1,
41 LongLong = 1 << 2,
42 Double = 1 << 3,
44 Date = 1 << 4,
45 Time = 1 << 5,
46 HideReadOnly = 1 << 6,
47 DateTime = 1 << 7,
48 Binary = 1 << 8,
49 Boolean = 1 << 9,
50 OriginProvider = 1 << 10,
52 };
53 Q_DECLARE_FLAGS( Filters, Filter )
54 Q_FLAG( Filters )
55
56
60 explicit QgsFieldProxyModel( QObject *parent SIP_TRANSFERTHIS = nullptr );
61
63 QgsFieldModel *sourceFieldModel() { return mModel; }
64
71
76 const Filters &filters() const { return mFilters; }
77
78 private:
79 Filters mFilters;
80 QgsFieldModel *mModel = nullptr;
81
83 bool isReadOnly( const QModelIndex &index ) const;
84
85 // QSortFilterProxyModel interface
86 public:
87 bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override;
88 bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override;
89};
90
92
93#endif // QGSFIELDPROXYMODEL_H
A model which displays the list of fields in widgets (optionally associated with a vector layer).
A proxy model to filter the list of fields of a layer.
QgsFieldModel * sourceFieldModel()
Returns the QgsFieldModel used in this QSortFilterProxyModel.
Filter
Field type filters.
@ DateTime
Datetime fields.
@ HideReadOnly
Hide read-only fields.
@ LongLong
Longlong fields.
@ Double
Double fields.
@ AllTypes
All field types.
@ Date
Date or datetime fields.
@ Binary
Binary fields, since QGIS 3.34.
@ Int
Integer fields.
@ String
String fields.
@ Boolean
Boolean fields, since QGIS 3.34.
@ Numeric
All numeric fields.
@ OriginProvider
Fields with a provider origin, since QGIS 3.38.
const Filters & filters() const
Returns the filters controlling displayed fields.
QgsFieldProxyModel(QObject *parent=nullptr)
QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model.
QFlags< Filter > Filters
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:275
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)