mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-08 00:02:35 -05:00
Add DateTime filter support to QgsFieldProxyModel
This commit is contained in:
parent
49731f21ec
commit
42562c6226
@ -85,6 +85,7 @@ bool QgsFieldProxyModel::filterAcceptsRow( int source_row, const QModelIndex &so
|
||||
( mFilters.testFlag( Double ) && type == QVariant::Double ) ||
|
||||
( mFilters.testFlag( Date ) && type == QVariant::Date ) ||
|
||||
( mFilters.testFlag( Date ) && type == QVariant::DateTime ) ||
|
||||
( mFilters.testFlag( DateTime ) && type == QVariant::DateTime ) ||
|
||||
( mFilters.testFlag( Time ) && type == QVariant::Time ) )
|
||||
return true;
|
||||
|
||||
|
@ -46,6 +46,7 @@ class CORE_EXPORT QgsFieldProxyModel : public QSortFilterProxyModel
|
||||
Date = 16, //!< Date or datetime fields
|
||||
Time = 32, //!< Time fields
|
||||
HideReadOnly = 64, //!< Hide read-only fields
|
||||
DateTime = 128, //!< Datetime fieldss
|
||||
AllTypes = Numeric | Date | String | Time, //!< All field types
|
||||
};
|
||||
Q_DECLARE_FLAGS( Filters, Filter )
|
||||
|
@ -306,6 +306,10 @@ void TestQgsFieldExpressionWidget::testFilters()
|
||||
QCOMPARE( widget->mCombo->count(), 1 );
|
||||
QCOMPARE( widget->mCombo->itemText( 0 ), QStringLiteral( "timefld" ) );
|
||||
|
||||
widget->setFilters( QgsFieldProxyModel::DateTime );
|
||||
QCOMPARE( widget->mCombo->count(), 1 );
|
||||
QCOMPARE( widget->mCombo->itemText( 0 ), QStringLiteral( "datetimefld" ) );
|
||||
|
||||
QgsProject::instance()->removeMapLayer( layer );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user