[Interest] ComboBox styling problems

J-P Nurmi jpnurmi at qt.io
Mon Apr 9 20:59:56 CEST 2018

> On 27 Mar 2018, at 03:41, Jason H <jhihn at gmx.com> wrote:
> I sent this a while back, but I never got help, and I still haven't figured it out. 
> -----
> I'm trying to style ComboBox, but I am getting a highlight that is not placed correctly, and there seems to be a semi-transparent black overlay that is also applying itself over the highlight?
> Can someone tell me what I'm doing wrong?

Some comments to get you started:
- Fix the "width: control.height" bindings.
- In the delegate, use Text as a contentItem, and Rectangle as a background. Control controls the size of contentItem, and background follows the size of the Control by default. No need for width/height bindings for either.
- If you want to use fontSizeMode, specify the font size range: http://doc-snapshots.qt.io/qt5-5.11/qml-qtquick-text.html#fontSizeMode-prop
- Set a higher Z-value if you want the ListView highlight to appear over the delegates: https://doc-snapshots.qt.io/qt5-5.9/qml-qtquick-listview.html#stacking-order-in-listview but you will be just hiding the entire delegate with an opaque rectangle, so perhaps consider visualizing the highlighted state in the delegate background instead.
- What's the purpose of the opaque Rectangle inside the ScrollIndicator?

J-P Nurmi

More information about the Interest mailing list