-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compute correct widget width for rich text labels #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! thanks!
bummer ... |
from the qt source code, looks like all
so we can just use regex and do: def might_be_rich_text(text):
import re
return bool(re.search("<[^\n]+>", text)) |
Codecov Report
@@ Coverage Diff @@
## master #199 +/- ##
==========================================
+ Coverage 90.07% 90.09% +0.02%
==========================================
Files 29 29
Lines 2981 2989 +8
==========================================
+ Hits 2685 2693 +8
Misses 296 296
Continue to review full report at Codecov.
|
Mhm, seems PySide2.QtGui.Qt.mightBeRichText
PyQt5.QtCore.Qt.mightBeRichText |
thanks! |
Currently, the width of label widgets that contain rich text (such as html tags) is computed based on the raw text alone. This may result in excessively large widgets, e.g. when including images.
For instance the following
leads to
The PR fixes how the default size of the label widget is computed for rich text labels. The above code then yields