25 #include <QDockWidget>
39 : QDockWidget( tr(
"System Time"), _pqParent )
41 QDockWidget::setObjectName(
"SystemTime" );
42 QDockWidget::setAllowedAreas( Qt::AllDockWidgetAreas );
44 QObject::connect(
this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
this, SLOT(
slotLocationChanged(Qt::DockWidgetArea) ) );
45 QObject::connect(
this, SIGNAL(topLevelChanged(
bool)),
this, SLOT(
slotTopLevelChanged(
bool) ) );
52 pqWidget->setStyleSheet(
".QWidget { BACKGROUND-COLOR: rgba(0,0,0,255); } .QLabel { COLOR: rgba(255,255,255,255); }" );
53 pqBoxLayout =
new QBoxLayout( QBoxLayout::LeftToRight );
67 pqLabelTime2->setToolTip( tr(
"Time (alternate timezone)") );
86 if(
pqBoxLayout->direction() == QBoxLayout::LeftToRight ) __iFontSize = std::min( 0.6*__iHeight, 0.05*__iWidth );
87 else __iFontSize = std::min( 0.225*__iHeight, 0.15*__iWidth );
88 if( __iFontSize < 20 ) __iFontSize = 20;
90 __qFontData.setPixelSize( __iFontSize );
91 __qFontData.setBold(
true );
95 QDockWidget::resizeEvent( _pqResizeEvent );
109 if( _qDockWidgetArea == Qt::TopDockWidgetArea || _qDockWidgetArea == Qt::BottomDockWidgetArea )
111 pqBoxLayout->setDirection( QBoxLayout::LeftToRight );
116 pqBoxLayout->setDirection( QBoxLayout::TopToBottom );
125 pqBoxLayout->setDirection( QBoxLayout::TopToBottom );
136 if( !QWidget::isVisible() )
return;
137 QDateTime __qDateTime = QDateTime::currentDateTime();
138 double __fdTime = __qDateTime.toUTC().toTime_t()+__qDateTime.time().msec()/1000.0;
void refreshContent()
Refreshes the content of the underlying widget.
QLabel * pqLabelTime
[UI:Label] Time
CTimeView(QWidget *_pqParent=0)
QWidget * pqWidget
[UI:Widget] Container widget
QBoxLayout * pqBoxLayout
[UI:Layout] Layout
void slotLocationChanged(Qt::DockWidgetArea _qDockWidgetArea)
Slot to handle dock area change.
void constructLayout()
Constructs the layout of the user-interface.
void slotTopLevelChanged(bool _bTopLevel)
Slot to handle floating change.
virtual void resizeEvent(QResizeEvent *_pqResizeEvent)
QLabel * pqLabelTime2
[UI:Label] Time (alternate timezone)
QLabel * pqLabelDate
[UI:Label] Date
static QString toString(double _fdValue, CUnitTimeZone::EUnit _eUnitTimeZone, EUnit _eUnit)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static QString toString(double _fdValue, CUnitTimeZone::EUnit _eUnitTimeZone, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...