[Interest] ComboBox with hintText?

J-P Nurmi jpnurmi at qt.io
Mon Oct 31 16:34:36 CET 2016


On Mon, 2016-10-31 at 16:23 +0100, Jason H wrote:
> I'm trying to have a QML ComboBox with a hint text capability, but
> none of my efforts are panning out. The idea is that the combobox has
> an unpicked initial state, and supplied a hint as to what the
> combobox contains. Once a selection is made the combobox functions
> normally.
> 
> I'm having trouble creating my own. I'm attempting to sue a Text +
> Combobox, but the model of the combobox does not update when the
> model is obtained from the server, and there seems to be no way to
> programatically open a ComboBox in QML.
> 
> So I'm here to ask, has this been solved before?
> 

You didn't specify any version, so I'm assuming you're using the latest
and greatest Qt Quick Controls 2.

You can specify ComboBox::displayText to show any text you want on the
button, and the popup you can access via ComboBox::popup, and call
open() on it.

- http://doc.qt.io/qt-5/qml-qtquick-controls2-combobox.html#displayText
-prop
- http://doc.qt.io/qt-5/qml-qtquick-controls2-combobox.html#popup-prop

-- 
J-P Nurmi




More information about the Interest mailing list