You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the delegate does not actually set any text, the reported text width is too narrow. textRect must account for the width of the text rendered by the QTextDocument instance.
The following patch fixes the problem:
diff --git a/labelme/widgets/label_list_widget.py b/labelme/widgets/label_list_widget.py
index 6164ef9..ace2b6e 100644
--- a/labelme/widgets/label_list_widget.py+++ b/labelme/widgets/label_list_widget.py@@ -4,6 +4,7 @@ from qtpy import QtGui
from qtpy.QtGui import QPalette
from qtpy import QtWidgets
from qtpy.QtWidgets import QStyle
+import math
# https://stackoverflow.com/a/2039745/4158863
@@ -44,6 +45,7 @@ class HTMLDelegate(QtWidgets.QStyledItemDelegate):
)
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options)
+ textRect.setWidth(int(math.ceil(self.doc.idealWidth())))
if index.column() != 0:
textRect.adjust(5, 0, 0, 0)
which sets the clip region correctly:
Expected Behavior
Item text is visible.
To Reproduce
Run ArchLinux with GNOME desktop and packages installed using pacman.
The text was updated successfully, but these errors were encountered:
Provide environment information
/usr/bin/python
Python 3.10.9
labelme 2b225b2
What OS are you using?
ArchLinux
Describe the Bug
On my GNOME desktop, the item text of Polygon Labels entries is practically invisible:
The problem is caused by this code:
https://github.com/wkentaro/labelme/blob/2b225b2b384bdb25fb37678a9d28b8e545732473/labelme/widgets/label_list_widget.py#L46-L57
Since the delegate does not actually set any text, the reported text width is too narrow.
textRect
must account for the width of the text rendered by theQTextDocument
instance.The following patch fixes the problem:
which sets the clip region correctly:
![Screenshot from 2023-01-12 00-40-15](https://user-images.githubusercontent.com/2170034/211941499-83720285-e11d-40bb-89f4-46b90e4ce24e.png)
Expected Behavior
Item text is visible.
To Reproduce
Run ArchLinux with GNOME desktop and packages installed using
pacman
.The text was updated successfully, but these errors were encountered: