Qt.py icon indicating copy to clipboard operation
Qt.py copied to clipboard

QStyleOptionViewItemV4 missing

Open mangopipeline opened this issue 7 years ago • 10 comments

What's the appropiate way to acess this class.... it was working on an erlier realse of Qt.py But seems to be broken in the latest realse

QtWidgets.QStyleOptionViewItemV4

i was basically using a try go between and QtWidgets.QStyleOptionViewItem(opt)

But now in qt4 QtWidgets.QStyleOptionViewItemV4 fails and QtWidgets.QStyleOptionViewItem(opt) doesn't draw properly....

any ideas?

mangopipeline avatar Dec 02 '17 03:12 mangopipeline

Hi @mangopipeline, sorry about that. If you submit a PR with this member in place, the automatic tests will kick in to check whether it exists across all bindings and if so, I'd be happy to merge this.

mottosso avatar Dec 02 '17 09:12 mottosso

Hey Marcus, Thanks for the reply... Taking a look now... Since tv inputs are the same would adding the mapping to the _misplaces_members dictionary be the way to go.

For what I can it’s a qt4 to qt5 So my guess is a should patch both pyqt4 and pyside keys?

mangopipeline avatar Dec 02 '17 14:12 mangopipeline

Also qt4 seems to actually use QStyleViewItemOptionV4 and QStyleViewItemOption

Could you offer some insight as to how the dictionary mapping would be changed?

I’m not sure that mapping “QStyleViewItemOptionV4” to “QStyleViewItemOption” is the right thing to do, As we would loose access to “QStyleViewItemOption”.

Maybe in practice it doesn’t matter?

mangopipeline avatar Dec 02 '17 14:12 mangopipeline

I'm not familiar enough with this member to know for sure, but perhaps the safest thing to do is append it to QtCompat such that it can be used explicitly.

from Qt import QtCompat
QtCompat.QStyleViewItemOptionV4

Or, if you prefer:

from Qt import QtCompat
QtCompat.QStyleViewItemOption

(Without the V4)

mottosso avatar Dec 02 '17 14:12 mottosso

looking at the way the binding are working.... there doesn't seem to be an easy way to map... "QStyleOptionViewItemV4":"QtGui.QStyleOptionViewItemV4", seems like i would have to do someting like "QStyleOptionViewItemV4":{'get":"QtGui.QStyleOptionViewItemV4",}

Does this sound correct?

mangopipeline avatar Dec 02 '17 15:12 mangopipeline

or maybe "init":"QtGui.QStyleOptionViewItemV4"?

mangopipeline avatar Dec 02 '17 16:12 mangopipeline

i did a pull request, not sure if i did it correctly as i don't do all of colabroation on git... cli test seem to be angry at me, info is a bit cryptic not sure, what i did wrong... https://github.com/mottosso/Qt.py/compare/master...mangopipeline:missing_QStyleOptionViewItemV4

mangopipeline avatar Dec 02 '17 17:12 mangopipeline

I think they rolled QStyleOptionViewItemV{2..4} into QStyleOptionViewItem in Qt5. Here's the obsolete members page for it. It looks like they left typedefs for them so I guess the later versions are backwards compatible. I'm not sure if Qt.py prefers to follow the Qt5 or PySide2 interface but it may make sense to expose all these names on QtWidgets and redirect them to QStyleOptionViewItem on the Qt5 bindings.

OEP avatar Dec 02 '17 19:12 OEP

That's basically how it would behave now for V4 except i have to use the .GET to generate it... if PyQt5 or PySide2 are loaded it redirects to QStyleOptionViewItem....

I'm not sure how many people use V2 and V3, but it it's easy enough to do it i'm not against it.... The part i'm not happy about is having to cast them to a .GET function, it be nice if the Dictionary had logic for doing direct casting of classes but it's dependent on the binding to know what what package to pull from QtGui, QtWidgets, etc...

that bind method would need some refactoring...

mangopipeline avatar Dec 02 '17 20:12 mangopipeline

#257 adding reference to the pull request here...

mangopipeline avatar Dec 02 '17 20:12 mangopipeline