View Single Post
Old 01-04-2022, 08:26 AM   #45
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,266
Karma: 16544702
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by kovidgoyal View Post
@davidfor: That's a bug in PyQt6. Just use the literal 1000 it should work in both. Or if you want to be elegant:

Code:
try:
    MyType = QTableWidgetItem.ItemType.UserType.value
except AttributeError:
    MyType = QTableWidgetItem.UserType
I'd already realised that this works:
Code:
QTableWidgetItem.__init__(self, text, 1000)
but thanks for the elegant option which also works.

I'm fairly sure the code both @davidfor and myself are using originates from @kiwidude's early plugins. Sorry if this is a dumb question, is there a good reason why a UserType needs to be specified at all, because this also appears to work? Presumably it defaults to a UserType of zero:
Code:
QTableWidgetItem.__init__(self, text)
jackie_w is offline   Reply With Quote