PySide2 QCombobox list dropdown issue
-
This UI was first set up using PySide and I am now making changes to upgrade it to PySide2, works as expected with PySide. I have a combobox that allows a user to select how a list is ordered. The issue I am running into is that when any item that is not index 0 in the combobox list is selected, subsequent selection of the combobox cause the dropdown list to shift to the selected item.
This is how it looks when the combobox isn't selected.
How it looks when "Modified" is selected, this is index 0 in the combobox.
And how it looks when "Created" is selected, the dropdown is shifted up.
.
This is when "Named" is selected.
Before PySide2 changes, this works and looks like this regardless of the selected item in the combobox. Would like to retain this.
I've look through the QT documentation for the QComboBox class, can't seem to find anything. Didn't find anything in styleesheets that could change this either. Any ideas how to use PySide2 but with PySide functionality?
-
@ariely
I don't think this has anything to do with PySide2 per se, nor would I expect it to be. I just tried it under Ubuntu from PySide2 and it does as you say, but it's identical from PyQt5.This does not sound like a language thing. Be it PyQt, PySide2 or PySide, they are wrappers around Qt library code. Are you sure you are not talking about a different version of Qt being used? And same Linux desktop/window manager? Is this a window manager thing, that's how it does combos?
Anyway, since PyQt5 is showing same, I conclude this is correct behaviour (unless someone wants to verify from C++?). I don't know what the old PySide was doing.
To try to find a combobox in another program, I have gone to Qt Creator > Tools > Options... > C++ > Code Style > Current settings. That is a combobox with 2 choices, and positioning of dropdown choices moves according as item selected. That tells you it's deliberate, default Qt behaviour, not PySide2. But I see other non-Qt apps present their comboboxes differently, so maybe there's no standard or it's a Qt thing under Linux.
-
As of 2017:
-
@alom
I don't know, but probably yes. If I were trying to achieve something like this, and I thought the Linux behaviour differed from the Windows behaviour, I'd be tempted to have a look/search through Qt source code to see if I could spot what they are doing or what I'm supposed to do. https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qcombobox.cpp.html. Just a thought for you.