Compare commits
	
		
			2 Commits
		
	
	
		
			e0e6abd453
			...
			cbbd531484
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					cbbd531484 | ||
| 
						 | 
					d845b4b1f4 | 
@ -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,14 +66,27 @@ 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)
 | 
			
		||||
        meta_layout.addStretch()
 | 
			
		||||
        
 | 
			
		||||
        # Offsets for unread badge anchoring (editable)
 | 
			
		||||
        self.unread_offset_right = 6
 | 
			
		||||
        self.unread_offset_bottom = 4
 | 
			
		||||
 | 
			
		||||
        # Add stretch to push next row to the bottom
 | 
			
		||||
        meta_layout.addStretch(1)
 | 
			
		||||
 | 
			
		||||
        # Bottom row: anchor unread badge to bottom-right with margins
 | 
			
		||||
        bottom_row = QHBoxLayout()
 | 
			
		||||
        bottom_row.setSpacing(0)
 | 
			
		||||
        bottom_row.setContentsMargins(0, 0, self.unread_offset_right, self.unread_offset_bottom)
 | 
			
		||||
        bottom_row.addStretch(1)
 | 
			
		||||
        bottom_row.addWidget(self.unread_label)
 | 
			
		||||
        meta_layout.addLayout(bottom_row)
 | 
			
		||||
 | 
			
		||||
        main_layout.addLayout(info_layout)
 | 
			
		||||
        # Push metadata (time + unread) to the far right
 | 
			
		||||
@ -87,7 +107,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']
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user