From d845b4b1f4b0ac34306f8126c854935513c48ef1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Oct 2025 01:27:06 +0300 Subject: [PATCH] chat patch --- app/ui/widgets/chat_list_item_widget.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/ui/widgets/chat_list_item_widget.py b/app/ui/widgets/chat_list_item_widget.py index 8f0572b..acd222d 100644 --- a/app/ui/widgets/chat_list_item_widget.py +++ b/app/ui/widgets/chat_list_item_widget.py @@ -1,4 +1,4 @@ -from PySide6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QLabel +from PySide6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QLabel, QSizePolicy from PySide6.QtGui import QPixmap, QPainter, QColor, QBrush from PySide6.QtCore import Qt from app.core.theme import theme_manager @@ -22,7 +22,7 @@ class ChatListItemWidget(QWidget): """Инициализирует пользовательский интерфейс виджета.""" main_layout = QHBoxLayout(self) # Reduce right margin to bring unread badge closer to edge - main_layout.setContentsMargins(10, 5, 6, 5) + main_layout.setContentsMargins(10, 5, 2, 5) main_layout.setSpacing(10) # Аватар @@ -49,9 +49,16 @@ class ChatListItemWidget(QWidget): # Delivery/read status icon (left of timestamp) self.status_label = QLabel("") - self.status_label.setFixedWidth(16) + self.status_label.setFixedWidth(12) + self.status_label.setFixedHeight(14) self.status_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) + self.status_label.setContentsMargins(0, 0, 0, 0) + self.status_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + self.timestamp_label = QLabel(timestamp) + self.timestamp_label.setFixedHeight(14) + self.timestamp_label.setAlignment(Qt.AlignVCenter | Qt.AlignRight) + self.timestamp_label.setContentsMargins(0, 0, 0, 0) self.unread_label = QLabel(str(unread_count) if unread_count > 0 else "") self.unread_label.setAlignment(Qt.AlignCenter) self.unread_label.setMargin(0) @@ -59,13 +66,14 @@ class ChatListItemWidget(QWidget): # Put status and time on a single row aligned right time_row = QHBoxLayout() - time_row.setSpacing(4) + time_row.setSpacing(1) time_row.setContentsMargins(0, 0, 0, 0) time_row.addWidget(self.status_label) time_row.addWidget(self.timestamp_label) time_row.addStretch() meta_layout.addLayout(time_row) - meta_layout.addWidget(self.unread_label) + # Keep unread badge pinned to the far right + meta_layout.addWidget(self.unread_label, 0, Qt.AlignRight) meta_layout.addStretch() main_layout.addLayout(info_layout) @@ -87,7 +95,7 @@ class ChatListItemWidget(QWidget): if getattr(self, 'is_outgoing', False): if getattr(self, 'is_read', None) is True: status_color = palette['accent'] - self.status_label.setStyleSheet(f"font-size: 9pt; color: {status_color}; background-color: transparent;") + self.status_label.setStyleSheet(f"font-size: 7pt; color: {status_color}; background-color: transparent;") self._update_status_icon() unread_bg = palette['accent']