PR: Add missing QtGui utility function to QtCore.Qt for PySide bindings#313
PR: Add missing QtGui utility function to QtCore.Qt for PySide bindings#313CAM-Gerlach merged 6 commits intospyder-ide:masterfrom
QtGui utility function to QtCore.Qt for PySide bindings#313Conversation
QtGui utility function to QtCore.Qt for PySide bindingsQtGui utility function to QtCore.Qt for PySide bindings
QtGui utility function to QtCore.Qt for PySide bindingsQtGui utility function to QtCore.Qt for PySide bindings
QtGui utility function to QtCore.Qt for PySide bindingsQtGui utility function to QtCore.Qt for PySide bindings
9542944 to
9de93c6
Compare
ccordoba12
left a comment
There was a problem hiding this comment.
Thanks @dalthviz for this! I left two small comments, otherwise looks good to me.
28723d3 to
f94ceca
Compare
There was a problem hiding this comment.
Thanks @dalthviz ! Looks like @ccordoba12 's suggestions were implemented, so this is ready to go with a couple trivial comments
Improve comment punctuation/caps Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
ccordoba12
left a comment
There was a problem hiding this comment.
Looks good to me now, thanks @dalthviz!
CAM-Gerlach
left a comment
There was a problem hiding this comment.
LGTM now, thanks @dalthviz !
|
Merging so we can fix the tests in the other PRs. |
| # trying to import `PyQt6.QtGui.Qt`, some functions like | ||
| # `PyQt6.QtCore.Qt.mightBeRichText` are missing. | ||
| try: | ||
| from PyQt6.QtGui import Qt |
There was a problem hiding this comment.
Just out of curiosity, shouldn't this overwrite the Qt imported from PyQt6.QtCore a bit earlier?
There was a problem hiding this comment.
I've stumbled upon the issue #311 while looking through the comments in the qtpy.QtCore code. Although it's merged ages ago, I'd like to discuss the fix a little.
What versions of PyQt6, PySide2, and PySide6 require the fix? I can't tell whether the code is long obsolete or still needed. Please clarify this somewhere.
Due the dates the issue was raised and fixed I would guess that is needed for Qt 6.1 or 6.2 bindings (although not completely sure 🤔). Also, did a quick check using PySide2 5.15.2.1 and I got this: So the fix is at least required by PySide 5.15.2.1. Could you give it a try to the Qt 6.2 bindings to check if the fix is still necessary there? |
|
So, the tests I've conducted gave the following results:
So, the fix is required for all current But that's not all.
Shouldn't def convertFromPlainText(plain: str, mode: Qt.WhiteSpaceMode = Qt.WhiteSpaceMode.WhiteSpacePre) -> str:
import html
plain = html.escape(plain)
if mode == Qt.WhiteSpaceMode.WhiteSpacePre:
plain = plain.replace(" ", "\xa0").replace("\t", "\xa0" * 4)
return "<p>" + plain + "</p>" |
|
Thanks for the new info @StSav012 ! Could you open a new issue with your findings? Seems like we need to work in a couple of things indeed |
|
I'm unsure whether it's worth it. I've run
All but the two first ones differ. Does anyone need the functions to spend time porting them? As for |
I guess for the moment no since no issue has been opened regarding that but it's good to know the variations that we could potentially handle And thanks for opening the issue! |

Fixes #311
Edit: Also fixes an issue with PyQt6 and sip to use
mightBeRichText: