Muti Selection in PyQt6?
-
@bebewinla said in Muti Selection in PyQt6?:
Are those obsolete in PyQt6?
Don't know. You did not say what the problem is...
-
@bebewinla
Both of the methods are just as available in [Py]Qt6 as they were in [Py]Qt5. [Though PySide6 does not seem to documentQTreeWidget.setSelectionModel()
, but I don't see why it should not be there.]However, I see these two statements each pass a Qt enumerated type value (
self.ExtendedSelection
,Qt.Qt.AscendingOrder
). Could it be on those tokens that you are getting an error message? ISTR that at PyQt6/PySide6 such enum values which were in the globalQt
namespace have been moved down into a more specific namespace. SoQt.AscendingOrder
needs to become something likeQt.SortOrder.AscendingOrder
. I don't know where you look up what these got changed to, and I am not even sure that the PySide6 documentation tells you, but you have to find out somehow.... -
I got this error :
self.setSelectionMode(self.ExtendedSelection)
AttributeError: 'Table' object has no attribute 'ExtendedSelection'where Table is a QtTreeWidget.
So I tried the following:
self.setSelectionMode(self.selectionMode.MultiSelection)
and it doesn't like it either. See error belowself.setSelectionMode(self.selectionMode.MultiSelection)
AttributeError: 'builtin_function_or_method' object has no attribute 'MultiSelection' -
@bebewinla
As I suggested, the enumerated type namespaces have changed, you need to use the correct ones in PyQt6.Also I don't think it's usual to access a enumerated value via
self
, e.g. likeself.ExtendedSelection
, I don't know whether Python allows this.