QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsdatetimesearchwidgetwrapper.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdatetimesearchwidgetwrapper.h
3 -------------------------------
4 Date : 2016-05-23
5 Copyright : (C) 2016 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
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 QGSDATETIMESEARCHWIDGETWRAPPER_H
17#define QGSDATETIMESEARCHWIDGETWRAPPER_H
18
20#include "qgis_sip.h"
21
22#include <QComboBox>
23#include <QListWidget>
24#include <QLineEdit>
25#include "qgis_gui.h"
26
28class QgsDateTimeEdit;
29
37{
38 Q_OBJECT
39
40 public:
41
48 explicit QgsDateTimeSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent SIP_TRANSFERTHIS = nullptr );
49
54 QVariant value() const;
55
56 bool applyDirectly() override;
57 QString expression() const override;
58 bool valid() const override;
61 QString createExpression( QgsSearchWidgetWrapper::FilterFlags flags ) const override;
62
63 public slots:
64
65 void clearWidget() override;
66 void setEnabled( bool enabled ) override;
67
68 protected:
69 QWidget *createWidget( QWidget *parent ) override;
70 void initWidget( QWidget *editor ) override;
71
72 protected slots:
73 void setExpression( const QString &exp ) override;
74
75 private slots:
76 void dateTimeChanged( const QDateTime &date );
77
78 private:
79 QgsDateTimeEdit *mDateTimeEdit = nullptr;
80 QgsVectorLayer *mLayer = nullptr;
81
83};
84
85#endif // QGSDATETIMESEARCHWIDGETWRAPPER_H
The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.
Wraps a date/time edit widget for searching.
Shows a search widget on a filter form.
void setEnabled(bool enabled) override
Toggles whether the search widget is enabled or disabled.
virtual QString createExpression(FilterFlags flags) const
Creates a filter expression based on the current state of the search widget and the specified filter ...
virtual QString expression() const =0
Will be used to access the widget's value.
virtual FilterFlags defaultFlags() const
Returns the filter flags which should be set by default for the search widget.
virtual void setExpression(const QString &expression)=0
Set the expression which is currently used as filter for this widget.
virtual FilterFlags supportedFlags() const
Returns filter flags supported by the search widget.
virtual bool applyDirectly()=0
If this is true, then this search widget should take effect directly when its expression changes.
virtual void clearWidget()
Clears the widget's current value and resets it back to the default state.
QFlags< FilterFlag > FilterFlags
Represents a vector layer which manages a vector based data sets.
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53