17 #include <QDateTimeEdit>    30     , mQDateTimeEdit( nullptr )
    31     , mQgsDateTimeEdit( nullptr )
    47     mQgsDateTimeEdit = qgsEditor;
    55     mQDateTimeEdit = qtEditor;
    58   if ( !mQDateTimeEdit )
    60     QgsDebugMsg( 
"Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." );
    68   const bool calendar = 
config( 
"calendar_popup", 
false ).toBool();
    71   const bool allowNull = 
config( 
"allow_null", 
true ).toBool();
    72   if ( mQgsDateTimeEdit )
    79                                            "For that the QGIS custom widget QgsDateTimeEdit needs to be used." ),
    83   if ( mQgsDateTimeEdit )
    95   return mQgsDateTimeEdit || mQDateTimeEdit;
    98 void QgsDateTimeEditWrapper::dateTimeChanged( 
const QDateTime& dateTime )
   106   if ( !mQDateTimeEdit )
   109   if ( 
field().type() == QVariant::DateTime )
   111     if ( mQgsDateTimeEdit )
   113       return mQgsDateTimeEdit->
dateTime();
   123   if ( mQgsDateTimeEdit )
   129     return mQDateTimeEdit->
dateTime().toString( fieldFormat );
   135   if ( !mQDateTimeEdit )
   141   if ( mQgsDateTimeEdit )
   153   if ( !mQDateTimeEdit )
 QWidget * createWidget(QWidget *parent) override
This method should create a new widget with the provided parent. 
 
QString toString(Qt::DateFormat format) const
 
QDateTime dateTime() const 
dateTime returns the date time which can eventually be a null date/time 
 
#define QGSDATETIMEEDIT_DATEFORMAT
 
QDateTime toDateTime() const
 
QgsDateTimeEditWrapper(QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent=nullptr)
 
QString tr(const char *sourceText, const char *disambiguation, int n)
 
QVariant value() const override
Will be used to access the widget's value. 
 
void setValue(const QVariant &value) override
 
void setEnabled(bool enabled) override
 
static void logMessage(const QString &message, const QString &tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary) 
 
QDateTime fromString(const QString &string, Qt::DateFormat format)
 
void initWidget(QWidget *editor) override
This method should initialize the editor widget with runtime data. 
 
bool valid() const override
Return true if the widget has been properly initialized. 
 
QDateTime currentDateTime()
 
static QgsMessageLog * instance()
 
void setAllowNull(bool allowNull)
determines if the widget allows setting null date/time. 
 
void setDateTime(const QDateTime &dateTime)
setDateTime set the date time in the widget and handles null date times. 
 
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
Represents a vector layer which manages a vector based data sets. 
 
The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times...
 
QVariant::Type type() const 
Gets variant type of the field as it will be retrieved from data source.