Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed localization of World Clock with Qt6 #2039

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugin-worldclock/lxqtworldclock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void LXQtWorldClock::updateTimeText()
if (!isUpToDate)
{
const QSize old_size = mContent->sizeHint();
mContent->setText(tzNow.toString(preformat(mFormat, timeZone, tzNow)));
mContent->setText(QLocale::system().toString(tzNow, preformat(mFormat, timeZone, tzNow)));
if (old_size != mContent->sizeHint())
mRotatedWidget->adjustContentSize();
mRotatedWidget->update();
Expand Down Expand Up @@ -447,7 +447,7 @@ QString LXQtWorldClock::formatDateTime(const QDateTime &datetime, const QString
{
QTimeZone timeZone(timeZoneName.toLatin1());
QDateTime tzNow = datetime.toTimeZone(timeZone);
return tzNow.toString(preformat(mFormat, timeZone, tzNow));
return QLocale::system().toString(tzNow, preformat(mFormat, timeZone, tzNow));
}

void LXQtWorldClock::updatePopupContent()
Expand Down Expand Up @@ -652,7 +652,7 @@ bool LXQtWorldClock::eventFilter(QObject * watched, QEvent * event)
timeZoneName = QString::fromLatin1(QTimeZone::systemTimeZoneId());
QTimeZone timeZone(timeZoneName.toLatin1());
QDateTime tzNow = now.toTimeZone(timeZone);
QToolTip::showText(helpEvent->globalPos(), tzNow.toString(QLocale{}.dateTimeFormat(QLocale::ShortFormat)));
QToolTip::showText(helpEvent->globalPos(), QLocale::system().toString(tzNow, QLocale::ShortFormat));
return false;
}
return QObject::eventFilter(watched, event);
Expand Down
Loading