show 24 hour format on tips

Change-Id: Id9beed7e99fd281c1989091ca7ec075ab0bf4598
This commit is contained in:
石博文 2017-03-31 16:48:49 +08:00
parent b416d4572d
commit 007650cf2c
Notes: Deepin Code Review 2017-04-01 10:00:57 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Sat, 01 Apr 2017 10:00:57 +0800
Reviewed-on: https://cr.deepin.io/21998
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 7 additions and 2 deletions

View File

@ -113,7 +113,10 @@ void DatetimePlugin::updateCurrentTimeString()
{
const QDateTime currentDateTime = QDateTime::currentDateTime();
m_dateTipsLabel->setText(currentDateTime.date().toString(Qt::SystemLocaleLongDate) + currentDateTime.toString(" HH:mm:ss"));
if (m_centralWidget->is24HourFormat())
m_dateTipsLabel->setText(currentDateTime.date().toString(Qt::SystemLocaleLongDate) + currentDateTime.toString(" HH:mm:ss"));
else
m_dateTipsLabel->setText(currentDateTime.date().toString(Qt::SystemLocaleLongDate) + currentDateTime.toString(" hh:mm:ss A"));
const QString currentString = currentDateTime.toString("mm");

View File

@ -52,8 +52,10 @@ void DatetimeWidget::paintEvent(QPaintEvent *e)
if (displayMode == Dock::Efficient)
{
const QString text = current.toString(m_24HourFormat ? "hh:mm" : "hh:mm A");
painter.setPen(Qt::white);
painter.drawText(rect(), Qt::AlignCenter, current.toString(m_24HourFormat ? "hh:mm" : "hh:mm A"));
painter.drawText(rect(), Qt::AlignCenter, text.left(5));
return;
}