We are using QtQuick.Controls 2.2 and can't downgrade due to various reasons. When we use Combobox
util from QML, it doesn't appear with selectByMouse
field which was introduced in 1.4 version.
Our requirement is -- to be able to select the text in the combobox for copying purpose as well as have a dropdown menu.
How to fix this issue; Is there any alternative?
As of Qt 5.9 / Quick Controls 2.2, the
ComboBox
now contains aTextField
to show the current text, if theComboBox
is set aseditible
. TextField does have theselectByMouse
property you require, only it is not exposed as a property of theComboBox
so it is not accessible by QML. However, it can be accessed in the javascript, e.g. from the Component.onCompleted attached signal handler.For example: