Hi, I have a ComboBox (QtQuick.Controls 2.5, Qt 5.12.4 ) and want to set a "placeholderText" on the ComboBox to display when no text is entered.
The ComboBox does not have "placeholderText" property and overwriting the complete contentItem of the ComboBox seems excessive to just do this to replicate the exsiting functionality (including read only or editable behaviour) If I look at the "Fusion/ComboBox.qml" implementation (I am using the Fusion Style), I can see that the contentItem is implemented using a "TextField" which means it does support this property. I have copied the contentItem definition from the implentation and when I set the placeholderText it behaves correctly. Is it possible to get access to the TextField used by the original implemenation and then set the "placeholderText" on it, without the need to re-implment the complete item? I have tried the following in the onCompleted handler of the ComboBox without success: {code} ComboBox { id: comboCategory_ ... Component.onCompleted: { console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") console.log( "ContentItem is : " + comboCategory_.contentItem ) console.log( "placeholderText is: " + comboCategory_.contentItem.placeholderText ) comboCategory_.contentItem.placeholderText = "<category>" console.log( "placeholderText is: " + comboCategory_.contentItem.placeholderText ) console.log("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb") } } {code} The ouptut is: {code} qml: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa qml: ContentItem is : QQuickTextField(0x17fe84249a0) qml: placeholderText is: qml: placeholderText is: <category> qml: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb {code} But the behaviour does not reflect the change. Is this something that can be done or should I create a bugreport for a feature request on the ComboBox element? Regards, Carel
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest