QML override element style

Is it possible to override only one property of a style, for example, combobox?

ComboBox { id: comboBox anchors.fill: parent style: ComboBoxStyle { label: Component { Text { text: "Players -> " + comboBox.currentText } } } } 

In KDE, this combobox looks ugly because it does not use the kde theme style and uses the default one.

ComboBox with canceled styles and no style overrides: ComboBox with overriden styles and without style override

I need to create a combined code on this image, similar to the last, but with custom text.

+5
source share
1 answer

I understand that you want to have your own appearance and customize the behavior.

You cannot get this out of the box using QtQuick Controls 1 or 2, as indicated in this Qt mailing list .

You can get your own style with Qt Widgets, but in addition to the added work with Qt Widgets, I don’t know if you can get a thematic native style ...

You can wait for Qt 6 CommonControls, as indicated here: http://blog.qt.io/blog/2017/02/06/native-look-feel/ , but this will not allow you to configure a lot, as indicated in the message.

0
source

Source: https://habr.com/ru/post/1207941/


All Articles