Is there anyway to use "classic" ComboBox look with QtQuick.Controls 2.x
-
I need to use
ComboBox
that looks like this (sorry for the quality of the image, I can't upload image from where I am):I also need to use
ComboBox
fromQtQuick.Controls 2.x
because I encountered a bug :ComboBox
fromQtQuick.Controls 1.x
doesn't catch my keyboards inputs (Keys.onPressed
never triggers).My problem is that
ComboBox
fromQtQuick.Controls 2.x
doesn't look like "classic" ComboBox.Is there a easy way to have a
QtQuick.Controls 2.x ComboBox
that has same look thanQtQuick.Controls 1.x ComboBox
? -
@Fheanor You can customize each Controls2 control, just look at the bottom of the detailed description of the component's documentation, there's a link to customizing. But first, the customization will be hardcoded, you can make it platform or style dependent only by hardcoding each wanted style. Second, the combobox is the most difficult to customize because it has so many elements. So the short answer to your question is "no". Try to find out if there's really a bug in the Controls1 combobox or if there's another way of doing what you want to achieve. If you want to get an ad hoc replacement combobox for a spefic style and platform it's doable with Controls2, otherwise it's easier to find and fix the bug in Controls2, IMO.
-
QtQuick.Control 1.5
-
@Eeli-K Thanks, I knew there is customization feature but it will not so easy to draw the "classic look".
I don't understand why there is no easy way to choose the old look in QtQuick.Controls 2.x
By the way, I have a strange behavior with ComboBox focus and pop up, please if you have time, have a look on : this
-
@Fheanor Controls 2 works differently, its purpose is to look and behave the same on all platforms, it's not "native" look&feel. I think the naming convention isn't good (Controls 1, Controls 2) because they are not different versions of the same controls, they are technologically different.
-
Well, it does have a major version difference. Classically you'd expect potential incompatibilities / entirely new design across a major version. At least I would...
I haven't used a lot of v1 but when I was picking up Qt and v2 controls I came across
https://doc.qt.io/qt-5/qtquickcontrols2-index.html
and
https://doc.qt.io/qt-5/qtquickcontrols2-differences.html
which I only discovered after realizing I was looking at documentation for a prior version. They got me back on track and explain the styling difference.