Skip to content

Commit 0329379

Browse files
pengfeixxdeepin-bot[bot]
authored andcommitted
fix: Fixed the tooltip not following the area format
Fixed the tooltip not following the area format Log: Fixed the tooltip not following the area format pms: BUG-342705
1 parent fbf66f8 commit 0329379

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

plugins/dde-dock/datetime/datetimewidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void DatetimeWidget::updateDateTimeString()
115115
if (position == Dock::Bottom || position == Dock::Top) {
116116
QString timeFormat = m_regionFormat->getShortTimeFormat();
117117
timeStr = locale.toString(current, timeFormat);
118-
dateString = current.toString(m_regionFormat->getShortDateFormat());
118+
dateString = locale.toString(current.date(), m_regionFormat->getShortDateFormat());
119119

120120
m_timeLabel->setText(timeStr);
121121
m_dateLabel->setText(dateString);
@@ -127,13 +127,13 @@ void DatetimeWidget::updateDateTimeString()
127127
QString timeFormat = m_regionFormat->getShortTimeFormat();
128128
timeFormat.replace("AP", "");
129129
timeFormat.replace(" ", "");
130-
timeStr = current.toString(timeFormat);
130+
timeStr = locale.toString(current.time(), timeFormat);
131131
} else {
132-
timeStr = current.toString(m_regionFormat->getShortTimeFormat());
132+
timeStr = locale.toString(current.time(), m_regionFormat->getShortTimeFormat());
133133
}
134134

135135
m_timeLabel->setText(timeStr);
136-
dateString = current.toString(m_regionFormat->getShortDateFormat());
136+
dateString = locale.toString(current.date(), m_regionFormat->getShortDateFormat());
137137
m_dateLabel->setText(dateString);
138138
}
139139
}

plugins/dde-dock/datetime/regionFormat.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ void RegionFormat::initConnect()
2727
setShortTimeFormat(m_config->value(key).toString());
2828
} else if (key == longTimeFormat_key) {
2929
setLongTimeFormat(m_config->value(key).toString());
30+
} else if (key == localeName_key) {
31+
setLocaleName(m_config->value(key).toString());
3032
}
3133
});
3234
}

0 commit comments

Comments
 (0)