Skip to content

Commit

Permalink
ui(qchat): set a fixed image chat message item value (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux authored Nov 19, 2024
1 parent 87ede82 commit e878ce2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qtribu/gui/qchat_tree_widget_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
AUTHOR_COLUM = 1
MESSAGE_COLUMN = 2

MAX_IMAGE_ITEM_HEIGHT = 24


class QChatTreeWidgetItem(QTreeWidgetItem):
"""
Expand Down Expand Up @@ -179,8 +181,8 @@ def __init__(self, parent: QTreeWidget, message: QChatImageMessage):
self.pixmap.loadFromData(data)
label = QLabel(self.parent())
label.setPixmap(self.pixmap)
label.setMaximumSize(label.sizeHint().width(), MAX_IMAGE_ITEM_HEIGHT)
self.treeWidget().setItemWidget(self, MESSAGE_COLUMN, label)
self.setSizeHint(MESSAGE_COLUMN, self.pixmap.size())

def on_click(self, column: int) -> None:
if column == MESSAGE_COLUMN:
Expand Down

0 comments on commit e878ce2

Please sign in to comment.