QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
22 #include "qcalendarwidget.h"
46 if ( ! mDateTimeEdit )
49 const bool fieldIsoFormat =
config( QStringLiteral(
"field_iso_format" ),
false ).toBool();
53 return mDateTimeEdit->
dateTime().toString( Qt::ISODate );
57 return mDateTimeEdit->
dateTime().toString( fieldFormat );
78 return fieldName +
" IS NULL";
80 return fieldName +
" IS NOT NULL";
87 return fieldName +
"='" + v.toString() +
'\'';
89 return fieldName +
"<>'" + v.toString() +
'\'';
91 return fieldName +
">'" + v.toString() +
'\'';
93 return fieldName +
"<'" + v.toString() +
'\'';
95 return fieldName +
">='" + v.toString() +
'\'';
97 return fieldName +
"<='" + v.toString() +
'\'';
114 mDateTimeEdit->setEnabled( enabled );
128 QString str = QStringLiteral(
"%1 = '%3'" )
130 exp.replace(
'\'', QLatin1String(
"''" ) )
135 void QgsDateTimeSearchWidgetWrapper::dateTimeChanged(
const QDateTime &dt )
139 QString exp =
value().toString();
141 if ( dt.isValid() && !dt.isNull() )
158 mDateTimeEdit = qobject_cast<QgsDateTimeEdit *>( editor );
165 mDateTimeEdit->setDisplayFormat( displayFormat );
167 const bool calendar =
config( QStringLiteral(
"calendar_popup" ),
false ).toBool();
168 mDateTimeEdit->setCalendarPopup( calendar );
169 if ( calendar && mDateTimeEdit->calendarWidget() )
172 QTextCharFormat todayFormat;
173 todayFormat.setBackground( QColor( 160, 180, 200 ) );
174 mDateTimeEdit->calendarWidget()->setDateTextFormat( QDate::currentDate(), todayFormat );
179 connect( mDateTimeEdit, &QDateTimeEdit::dateTimeChanged,
this, &QgsDateTimeSearchWidgetWrapper::dateTimeChanged );
The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.
void setEmpty()
Resets the widget to show no value (ie, an "unknown" state).
QgsFields fields() const FINAL
Returns the list of fields of this layer.
QDateTime dateTime() const
Returns the date time which can be a null date/time.
void setAllowNull(bool allowNull)
Determines if the widget allows setting null date/time.
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)