16#ifndef QGSDATETIMEWITHTIMEZONEWIDGET_H
17#define QGSDATETIMEWITHTIMEZONEWIDGET_H
24#include <QAbstractItemModel>
25#include <QConcatenateTablesProxyModel>
28#include <QSortFilterProxyModel>
35class StandardTimeZoneModel;
36class StandardTimeZoneProxyModel;
37class QDialogButtonBox;
54 TimeZoneId = Qt::UserRole,
65 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
66 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
67 QVariant data(
const QModelIndex &index,
int role )
const override;
68 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
69 QModelIndex parent(
const QModelIndex &index )
const override;
74 QModelIndex indexFromTimeZone(
const QTimeZone &timeZone )
const;
79 static QString displayStringForTimeZone(
const QTimeZone &timeZone, QTimeZone::NameType nameType = QTimeZone::NameType::DefaultName );
85 QString displayString;
89 static std::vector< TimeZoneItem > sItems;
91 static QString offsetToString(
int seconds );
122 QModelIndex indexFromTimeZone(
const QTimeZone &timeZone )
const;
132 void setFilterString(
const QString &filter );
135 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
136 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
140 QString mFilterString;
196 void itemDoubleClicked(
const QModelIndex &index );
203 QListView *mListView =
nullptr;
246 QDialogButtonBox *mButtonBox =
nullptr;
322 void selectTimeZone();
325 QComboBox *mComboBox =
nullptr;
326 QToolButton *mButton =
nullptr;
327 StandardTimeZoneProxyModel *mTimeZoneModel =
nullptr;
328 int mBlockSignals = 0;
329 QPointer< QgsTimeZoneWidget> mActivePanel;
330 int mIgnorePanelSignals = 0;
331 QString mDialogTitle;
338class StandardTimeZoneModel :
public QAbstractItemModel
SIP_SKIP
343 enum class CustomRole :
int
345 TimeZone = Qt::UserRole,
349 QVariant data(
const QModelIndex &index,
int role )
const override;
350 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
351 int columnCount(
const QModelIndex & = QModelIndex() )
const override;
352 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
353 QModelIndex parent(
const QModelIndex &index )
const override;
357 void setCurrentTimeZone(
const QTimeZone &timeZone );
361 QTimeZone mCurrentTimeZone;
364class StandardTimeZoneProxyModel :
public QSortFilterProxyModel
SIP_SKIP
371 void setCurrentTimeZone(
const QTimeZone &timeZone );
375 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
378 StandardTimeZoneModel *mModel =
nullptr;
454 int mBlockSignals =
false;
A QDateTimeEdit with the capability of setting/reading null date/times.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
A combo box widget for selection of available time zones.
void setTimeZone(const QTimeZone &zone)
Sets the current time zone to select in the widget.
QString dialogTitle() const
Returns the title for the time zone selector dialog window.
void timeZoneChanged(const QTimeZone &zone)
Emitted when the selected time zone is changed.
QFlags< StandardItem > StandardItems
Standard time zone options.
QgsTimeZoneComboBox(QWidget *parent=nullptr)
Constructor for QgsTimeZoneComboBox, with the specified parent widget.
QTimeZone timeZone() const
Returns the selected time zone.
void setDialogTitle(const QString &title)
Sets the title for the time zone selector dialog window.
StandardItem
Standard time zone options.
QTimeZone timeZone() const
Returns the selected time zone.
QgsTimeZoneDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Constructor for QgsTimeZoneDialog.
void setTimeZone(const QTimeZone &zone)
Sets the current time zone to select in the dialog.
A custom model for display of available time zones.
QgsTimeZoneItemModel(QObject *parent=nullptr)
Constructor for a QgsTimeZoneItemModel with the specified parent object.
A sort filter model for display of available time zones.
QgsTimeZoneSortFilterModel(QgsTimeZoneItemModel *source, QObject *parent=nullptr)
Constructor for a QgsTimeZoneSortFilterModel with the specified parent object and source model.
QString filterString() const
Returns the current filter string, if set.
#define SIP_ENUM_BASETYPE(type)