[Solved] ComboBox styling useless?
-
Hi.
I'm trying to style a "ComboBox":http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-combobox.html (Windows 8 look and feel) but having trouble doing so. I cannot find anything in the "docs":http://qt-project.org/doc/qt-5.1/qtquickcontrolsstyles/qml-qtquick-controls-styles1-comboboxstyle.html. The below code only styles the "Button area" and not the drop down list, leaving me with a nice looking ComboBox that should not be clicked (Just like when you get a chocolate from a box and it turns out the inside is just horrible! )
I surely hope that this is fixable... I cannot ship with ComboBox's looking like that!
Code:
@import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
...
ComboBox {
width: 200
model: [ "Banana", "Apple", "Coconut" ]style: ComboBoxStyle { background: Rectangle { height: 100 width: control.width color: "white" border.color: "lightgray" border.width: 1 Image{ source: "../Images/wl_arrow.png" fillMode: Image.PreserveAspectFit verticalAlignment: Image.AlignVCenter anchors{ top: parent.top bottom: parent.bottom right: parent.right rightMargin: 5 } } MouseArea{ anchors.fill: parent hoverEnabled: true onEntered: parent.color = "lightblue" onExited: parent.color = "white" } } label:Text { font.family: "Segoe UI" font.pointSize: 10 text: control.currentText } } }@
-
You can style the dropdown with some hidden delegates as suggested by @Jens in another thread.
To see an example of using those "hidden" delegates, check "this reply":http://qt-project.org/forums/viewthread/33188/#149560
-
Thanks a lot!
There should be a reference to this post in the documentation!