QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Signals | Public Member Functions | Protected Member Functions | List of all members
QgsTimeEdit Class Reference

The QgsTimeEdit class is a QTimeEdit widget with the capability of setting/reading null date/times. More...

#include <qgsdatetimeedit.h>

Inheritance diagram for QgsTimeEdit:
Inheritance graph
[legend]

Signals

void timeValueChanged (const QTime &time)
 Signal emitted whenever the time changes. More...
 
- Signals inherited from QgsDateTimeEdit
void valueChanged (const QDateTime &date)
 Signal emitted whenever the value changes. More...
 

Public Member Functions

 QgsTimeEdit (QWidget *parent=nullptr)
 Constructor for QgsTimeEdit. More...
 
void setTime (const QTime &time)
 Sets the time for the widget and handles null times. More...
 
- Public Member Functions inherited from QgsDateTimeEdit
 QgsDateTimeEdit (QWidget *parent=nullptr)
 Constructor for QgsDateTimeEdit. More...
 
bool allowNull () const
 If the widget allows setting null date/time. More...
 
void clear () override
 Set the current date as NULL. More...
 
QDate date () const
 Returns the date which can be a null date. More...
 
QDateTime dateTime () const
 Returns the date time which can be a null date/time. More...
 
QString nullRepresentation () const
 Returns the widget's NULL representation, which defaults to QgsApplication::nullRepresentation(). More...
 
void setAllowNull (bool allowNull)
 Determines if the widget allows setting null date/time. More...
 
void setDateTime (const QDateTime &dateTime)
 Set the date time in the widget and handles null date times. More...
 
void setEmpty ()
 Resets the widget to show no value (ie, an "unknown" state). More...
 
void setNullRepresentation (const QString &null)
 Sets the widget's null representation, which defaults to QgsApplication::nullRepresentation(). More...
 
QTime time () const
 Returns the time which can be a null time. More...
 

Protected Member Functions

void emitValueChanged (const QVariant &value) override
 Emits the widget's correct value changed signal. More...
 
- Protected Member Functions inherited from QgsDateTimeEdit
void displayNull (bool updateCalendar=false)
 write the null value representation to the line edit without changing the value More...
 
void focusInEvent (QFocusEvent *event) override
 
void focusOutEvent (QFocusEvent *event) override
 
bool isNull () const
 Returns true if the widget is currently set to a null value. More...
 
void mousePressEvent (QMouseEvent *event) override
 
void showEvent (QShowEvent *event) override
 
void wheelEvent (QWheelEvent *event) override
 

Additional Inherited Members

- Protected Attributes inherited from QgsDateTimeEdit
int mBlockChangedSignal = 0
 Block change signals if true. More...
 
bool mIsEmpty = false
 true if the widget is empty More...
 
- Properties inherited from QgsDateTimeEdit
bool allowNull
 

Detailed Description

The QgsTimeEdit class is a QTimeEdit widget with the capability of setting/reading null date/times.

Warning
You should use the signal valueChanged of this subclass rather than QDateTimeEdit::timeChanged. (If you consequently connect parent's timeChanged signal and call time() afterwards there is no guarantee that NULL values will be correctly handled).
See also
QgsDateTimeEdit
QgsDateEdit
Since
QGIS 3.14

Definition at line 226 of file qgsdatetimeedit.h.

Constructor & Destructor Documentation

◆ QgsTimeEdit()

QgsTimeEdit::QgsTimeEdit ( QWidget *  parent = nullptr)
explicit

Constructor for QgsTimeEdit.

The current time is used by default. The widget is allowing null by default. If allow null is disabled, you should check allowNull before getting values from the widget.

Definition at line 365 of file qgsdatetimeedit.cpp.

Member Function Documentation

◆ emitValueChanged()

void QgsTimeEdit::emitValueChanged ( const QVariant &  value)
overrideprotectedvirtual

Emits the widget's correct value changed signal.

Reimplemented from QgsDateTimeEdit.

Definition at line 392 of file qgsdatetimeedit.cpp.

◆ setTime()

void QgsTimeEdit::setTime ( const QTime &  time)

Sets the time for the widget and handles null times.

Note
Since QDateTimeEdit::setTime() is not virtual, setTime must be called for QgsTimeEdit.

Definition at line 371 of file qgsdatetimeedit.cpp.

◆ timeValueChanged

void QgsTimeEdit::timeValueChanged ( const QTime &  time)
signal

Signal emitted whenever the time changes.


The documentation for this class was generated from the following files: