mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
DolphinQt: Ensure skylanders QDateTimeEdit shows a four digit year without forcing dd-mm-yyyy format.
This commit is contained in:
parent
adafe1f347
commit
149a3721ff
6 changed files with 43 additions and 9 deletions
22
Source/Core/DolphinQt/QtUtils/QtUtils.cpp
Normal file
22
Source/Core/DolphinQt/QtUtils/QtUtils.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2024 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
|
||||
#include <QDateTimeEdit>
|
||||
|
||||
namespace QtUtils
|
||||
{
|
||||
|
||||
void ShowFourDigitYear(QDateTimeEdit* widget)
|
||||
{
|
||||
if (!widget->displayFormat().contains(QStringLiteral("yyyy")))
|
||||
{
|
||||
// Always show the full year, no matter what the locale specifies. Otherwise, two-digit years
|
||||
// will always be interpreted as in the 21st century.
|
||||
widget->setDisplayFormat(
|
||||
widget->displayFormat().replace(QStringLiteral("yy"), QStringLiteral("yyyy")));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace QtUtils
|
Loading…
Add table
Add a link
Reference in a new issue