diff --git a/qtribu/gui/qchat_tree_widget_items.py b/qtribu/gui/qchat_tree_widget_items.py index f6973751..be05d9f5 100644 --- a/qtribu/gui/qchat_tree_widget_items.py +++ b/qtribu/gui/qchat_tree_widget_items.py @@ -39,6 +39,8 @@ AUTHOR_COLUM = 1 MESSAGE_COLUMN = 2 +MAX_IMAGE_ITEM_HEIGHT = 24 + class QChatTreeWidgetItem(QTreeWidgetItem): """ @@ -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: