[Interest] QML: PlaceholderText on ComboBox (Controls 2)

Carel Combrink carel.combrink at gmail.com
Mon Sep 2 10:26:11 CEST 2019

> That should work (and it appears to from the output), so I'm not sure why
> you don't see the placeholder text, assuming that is the actual issue here.
I am not seeing the placeholder text

> The way you're doing it in onCompleted is the easiest way to do it
> currently, and it should work. Can you please post a minimal example here
> so we can see why it's not working first?
I have attached a main.qml file that can be executed with the qml
applicaiton: qml main.qml (I am on windows)

The following screenshot shows what I get when I run the qml file with Qt
5.12.3 and 5.12.4 on Windows
The checkbox controls if the combo boxes are editable to show that the
placeholder text is still shown in the second box when toggled.
The first ComboBox uses the method mentioned in my original email.
The second ComboBox I have copied the style from the Fusion and set the
placeholderText directly on the TextField

[image: image.png]

> As for a feature request, you can create one if you want. I wonder if
> something like Nils' idea of exposing a textField property would be the
> best solution to this:
> https://bugreports.qt.io/browse/QTBUG-71406?focusedCommentId=438916&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-438916
> Usually the contentItem is a TextField, but if it's not, it would just be
> null. The problem is that this same issue likely applies to lots of other
> controls, and it might end up in a slippery slope of adding these
> type-specific accessor properties.

I would also support either exposing the item or seeing if what I am trying
can be fixed.
Strangely the "selectByMouse" option can be changed using the "
comboCategory_.contentItem.selectByMouse = true" code and it works as
expected (set in the attached code)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190902/e8be86da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 28504 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190902/e8be86da/attachment.png>

More information about the Interest mailing list