Fix return type of `dialogStyleForPalette()` for Windows implementation

This commit is contained in:
Martchus 2023-03-26 19:37:13 +02:00
parent 8642f14bb1
commit 121d6a10db
2 changed files with 5 additions and 5 deletions

View File

@ -95,7 +95,7 @@ QColor instructionTextColor()
* \brief Returns the stylesheet for dialogs and other windows used in my
* applications.
*/
const QString &dialogStyleForPalette(const QPalette &palette)
QString dialogStyleForPalette(const QPalette &palette)
{
#ifdef Q_OS_WINDOWS
return QStringLiteral("#mainWidget { color: palette(text); background-color: "
@ -109,9 +109,8 @@ const QString &dialogStyleForPalette(const QPalette &palette)
.arg(windowFrameColorForPalette(palette).name(), instructionTextColorForPalette(palette).name());
#else
Q_UNUSED(palette)
static const auto style = QStringLiteral("*[classNames~=\"heading\"] { font-weight: bold; }"
return QStringLiteral("*[classNames~=\"heading\"] { font-weight: bold; }"
"*[classNames~=\"input-invalid\"] { color: red; }");
return style;
#endif
}
@ -121,7 +120,8 @@ const QString &dialogStyleForPalette(const QPalette &palette)
*/
const QString &dialogStyle()
{
return dialogStyleForPalette(QGuiApplication::palette());
static const auto style = dialogStyleForPalette(QGuiApplication::palette());
return style;
}
#ifdef QT_UTILITIES_GUI_QTWIDGETS

View File

@ -37,7 +37,7 @@ QT_UTILITIES_EXPORT QColor windowFrameColorForPalette(const QPalette &palette);
QT_UTILITIES_EXPORT QColor instructionTextColorForPalette(const QPalette &palette);
#endif
[[deprecated]] QT_UTILITIES_EXPORT const QString &dialogStyle();
QT_UTILITIES_EXPORT const QString &dialogStyleForPalette(const QPalette &palette);
QT_UTILITIES_EXPORT QString dialogStyleForPalette(const QPalette &palette);
#ifdef QT_UTILITIES_GUI_QTWIDGETS
QT_UTILITIES_EXPORT QRect availableScreenGeometryAtPoint(const QPoint &point);
QT_UTILITIES_EXPORT void centerWidget(QWidget *widget, const QWidget *parent = nullptr, const QPoint *position = nullptr);