Styles not behaving as expected.
-
Hi all -
I've been wrestling with styles in my app, and have found some issues when running on Windows. Here's the code that sets the style:
QString l_styleName = (platform == "android") ? "Material" : (platform == "windows") ? "Windows" : "Fusion"; QQuickStyle::setStyle(l_styleName);What I've found through experimentation is:
- Universal style doesn't seem to use the palette.buttonText setting for changing the color of text within Buttons
- Basic and Fusion ignore the accent color setting when used like this:
ApplicationWindow { id: mainWindow readonly property string degreeSymbol: String.fromCodePoint(0xb0) readonly property string bullet: String.fromCodePoint(0x2022) readonly property real margin: width / 32.0 readonly property real gutter: width / 64.0 property alias auxTabIndex: auxTabBar.currentIndex Component.onCompleted: { if (styleName === "Material") { Material.accent = Colors.background } else if (styleName === "Fusion") { Fusion.accent = Colors.background//Colors.primaryPurple } else if (styleName === "Basic") { Basic.accent = Colors.primaryPurple } else if (styleName === "Universal") { Universal.accent = Colors.background//Colors.primaryPurple } else if (styleName === "Windows") { Windows.accent = Colors.background//Colors.primaryPurple } }Moreover, when I set the style to "Windows," I get an error: "ReferenceError: Windows is not defined."
It's hard to believe these are bugs in the style definitions, but I can't see what I'm doing wrong. Any ideas?
Thanks...
-
@piervalli I've never used that before; just tried it now. I created the file with this in it:
[Controls] Style=Universal [Universal] Theme=Light Accent=Universal.IndigoAnd added the file to my qml.qrc. I didn't add an entry to my CMakeLists.txt file, but I'm not sure I need to, as the file appears to get loaded. I say this because I'm getting the following error:
Universal: unknown accent value: Universal.IndigoA couple questions:
- is there something I need to do to use the Universal colors, to get rid of this error message?
- can I specify 'transparent" as my accent color?
Thanks...
-
Hi all -
I've been wrestling with styles in my app, and have found some issues when running on Windows. Here's the code that sets the style:
QString l_styleName = (platform == "android") ? "Material" : (platform == "windows") ? "Windows" : "Fusion"; QQuickStyle::setStyle(l_styleName);What I've found through experimentation is:
- Universal style doesn't seem to use the palette.buttonText setting for changing the color of text within Buttons
- Basic and Fusion ignore the accent color setting when used like this:
ApplicationWindow { id: mainWindow readonly property string degreeSymbol: String.fromCodePoint(0xb0) readonly property string bullet: String.fromCodePoint(0x2022) readonly property real margin: width / 32.0 readonly property real gutter: width / 64.0 property alias auxTabIndex: auxTabBar.currentIndex Component.onCompleted: { if (styleName === "Material") { Material.accent = Colors.background } else if (styleName === "Fusion") { Fusion.accent = Colors.background//Colors.primaryPurple } else if (styleName === "Basic") { Basic.accent = Colors.primaryPurple } else if (styleName === "Universal") { Universal.accent = Colors.background//Colors.primaryPurple } else if (styleName === "Windows") { Windows.accent = Colors.background//Colors.primaryPurple } }Moreover, when I set the style to "Windows," I get an error: "ReferenceError: Windows is not defined."
It's hard to believe these are bugs in the style definitions, but I can't see what I'm doing wrong. Any ideas?
Thanks...
-
Hi I have created a class in C++, So I used Material.accent = AppStyle.background
@piervalli it doesn't seem to matter what value I put in that line; it's just ignored. With Universal as my style, I get a red underbar as my accent.
-
@piervalli it doesn't seem to matter what value I put in that line; it's just ignored. With Universal as my style, I get a red underbar as my accent.
-
https://doc.qt.io/qt-5/qtquickcontrols2-configuration.html
Have you tried with qtquickcontrols2.conf?@piervalli I've never used that before; just tried it now. I created the file with this in it:
[Controls] Style=Universal [Universal] Theme=Light Accent=Universal.IndigoAnd added the file to my qml.qrc. I didn't add an entry to my CMakeLists.txt file, but I'm not sure I need to, as the file appears to get loaded. I say this because I'm getting the following error:
Universal: unknown accent value: Universal.IndigoA couple questions:
- is there something I need to do to use the Universal colors, to get rid of this error message?
- can I specify 'transparent" as my accent color?
Thanks...
-
@piervalli I've never used that before; just tried it now. I created the file with this in it:
[Controls] Style=Universal [Universal] Theme=Light Accent=Universal.IndigoAnd added the file to my qml.qrc. I didn't add an entry to my CMakeLists.txt file, but I'm not sure I need to, as the file appears to get loaded. I say this because I'm getting the following error:
Universal: unknown accent value: Universal.IndigoA couple questions:
- is there something I need to do to use the Universal colors, to get rid of this error message?
- can I specify 'transparent" as my accent color?
Thanks...
-
M mzimmers has marked this topic as solved on
