summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Dubsky <[email protected]>2025-11-20 18:32:49 +0100
committerPavel Dubsky <[email protected]>2025-11-28 19:08:39 +0100
commitf4bf66b498816b6078e1fe1f739d8fce2dab4543 (patch)
tree5bdb91f0fe39d67741780709858fa38149c74238
parent862a13759ba0d4ab407de3a12d019a54970fbbf3 (diff)
Extract classNameSuffix helper in window class registry
Added a new helper function classNameSuffix to generate class name suffixes based on window type, style flags, and icon presence. Change-Id: I70c20f211255d9e79fc6e7e3b79dbefd861bf7be Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--src/plugins/platforms/windows/qwindowswindowclassdescription.cpp54
-rw-r--r--src/plugins/platforms/windows/qwindowswindowclassdescription.h2
2 files changed, 33 insertions, 23 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp b/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp
index e2e46a7b215..abd6f02fb0b 100644
--- a/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp
+++ b/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp
@@ -11,6 +11,36 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
+QString QWindowsWindowClassDescription::classNameSuffix(Qt::WindowFlags type, unsigned int style, bool hasIcon)
+{
+ QString suffix;
+
+ switch (type) {
+ case Qt::Popup:
+ suffix += "Popup"_L1;
+ break;
+ case Qt::Tool:
+ suffix += "Tool"_L1;
+ break;
+ case Qt::ToolTip:
+ suffix += "ToolTip"_L1;
+ break;
+ default:
+ break;
+ }
+
+ if (style & CS_DROPSHADOW)
+ suffix += "DropShadow"_L1;
+ if (style & CS_SAVEBITS)
+ suffix += "SaveBits"_L1;
+ if (style & CS_OWNDC)
+ suffix += "OwnDC"_L1;
+ if (hasIcon)
+ suffix += "Icon"_L1;
+
+ return suffix;
+}
+
QWindowsWindowClassDescription QWindowsWindowClassDescription::fromName(QString name, WNDPROC procedure)
{
return { std::move(name), procedure };
@@ -48,29 +78,7 @@ QWindowsWindowClassDescription QWindowsWindowClassDescription::fromWindow(const
description.hasIcon = false; // QTBUG-2027, dialogs without system menu.
break;
}
- // Create a unique name for the flag combination
- description.name = "QWindow"_L1;
- switch (type) {
- case Qt::Tool:
- description.name += "Tool"_L1;
- break;
- case Qt::ToolTip:
- description.name += "ToolTip"_L1;
- break;
- case Qt::Popup:
- description.name += "Popup"_L1;
- break;
- default:
- break;
- }
- if (description.style & CS_DROPSHADOW)
- description.name += "DropShadow"_L1;
- if (description.style & CS_SAVEBITS)
- description.name += "SaveBits"_L1;
- if (description.style & CS_OWNDC)
- description.name += "OwnDC"_L1;
- if (description.hasIcon)
- description.name += "Icon"_L1;
+ description.name = "QWindow"_L1 + classNameSuffix(type, description.style, description.hasIcon);
return description;
}
diff --git a/src/plugins/platforms/windows/qwindowswindowclassdescription.h b/src/plugins/platforms/windows/qwindowswindowclassdescription.h
index 3acca65b8a2..692bf18e618 100644
--- a/src/plugins/platforms/windows/qwindowswindowclassdescription.h
+++ b/src/plugins/platforms/windows/qwindowswindowclassdescription.h
@@ -25,6 +25,8 @@ struct QWindowsWindowClassDescription
bool shouldAddPrefix{ true };
private:
+ static QString classNameSuffix(Qt::WindowFlags type, unsigned int style, bool hasIcon);
+
friend QDebug operator<<(QDebug dbg, const QWindowsWindowClassDescription &description);
};