I've made some QtQuick programs, and I thought it was all working fine, till I tried them out on my laptop, which is running KDE, with the Breeze Dark theme.
A simple program with a label is barely readable:
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
Window
{
visible: true
Label
{
font.pointSize: 20
text: "Hello world!"
}
}
With KDE Breeze Dark:
With XFCE:
I have a customised combobox too, and it looks terrible under KDE. It has the same issue on the default KDE theme, just with the colours inverted:
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick 2.7
Window
{
visible: true
minimumWidth: 200
minimumHeight: 200
ComboBox
{
id: combo
model: ["Apple", "Banana", "Orange"]
width: 150
height: 50
delegate: ItemDelegate
{
id: item
width: parent.width
contentItem: Text
{
text: modelData
font.pointSize: 15
}
MouseArea
{
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onClicked: mouse.accepted = false
onPressed: mouse.accepted = false
onReleased: mouse.accepted = false
onDoubleClicked: mouse.accepted = false
onPositionChanged: mouse.accepted = false
onPressAndHold: mouse.accepted = false
onEntered:
{
item.highlighted = true
}
onExited:
{
item.highlighted = false
}
}
}
contentItem: Text
{
id: dropDown
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 15
text: combo.displayText
}
}
}
With KDE Breeze Dark:
With XFCE:
So, I'm not sure if this is a KDE issue, or a QtQuick issue. I guess I want to know how I can either disable KDE theming of certain programs, or modify my Qml to display my programs nicely when themed. I couldn't find barely any literature on QtQuick theming, aside from some proposals or ways to manually implement it.
You can use SystemPalette . For example:
Window {
visible: true
color: palette.window
Label {
font.pointSize: 20
text: "Hello world!"
}
SystemPalette {
id: palette
colorGroup: SystemPalette.Active
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.