From ce8884f4c736fcc9abe4f500913830e71237cf37 Mon Sep 17 00:00:00 2001 From: Alberto Sottile Date: Fri, 10 May 2019 23:55:48 +0200 Subject: [PATCH] macOS: fix selection highlight in MainWindow userList --- syncplay/constants.py | 4 +++- syncplay/ui/gui.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index 2453d50..2ed523c 100755 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -214,7 +214,9 @@ STYLE_UNTRUSTEDITEM_COLOR = 'purple' TLS_CERT_ROTATION_MAX_RETRIES = 10 -USERLIST_GUI_USERNAME_OFFSET = 21 # Pixels +USERLIST_GUI_USERNAME_OFFSET = getValueForOS({ + OS_DEFAULT: 21, + OS_MACOS: 26}) # Pixels USERLIST_GUI_USERNAME_COLUMN = 0 USERLIST_GUI_FILENAME_COLUMN = 3 diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 1f21f07..7683420 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -71,6 +71,10 @@ class UserlistItemDelegate(QtWidgets.QStyledItemDelegate): crossIconQPixmap = QtGui.QPixmap(resourcespath + "cross.png") roomController = currentQAbstractItemModel.data(itemQModelIndex, Qt.UserRole + constants.USERITEM_CONTROLLER_ROLE) userReady = currentQAbstractItemModel.data(itemQModelIndex, Qt.UserRole + constants.USERITEM_READY_ROLE) + isUserRow = indexQModelIndex.parent() != indexQModelIndex.parent().parent() + if isUserRow and isMacOS(): + whiteRect = QtCore.QRect(0, optionQStyleOptionViewItem.rect.y(), optionQStyleOptionViewItem.rect.width(), optionQStyleOptionViewItem.rect.height()) + itemQPainter.fillRect(whiteRect, QtGui.QColor(Qt.white)) if roomController and not controlIconQPixmap.isNull(): itemQPainter.drawPixmap( @@ -89,7 +93,6 @@ class UserlistItemDelegate(QtWidgets.QStyledItemDelegate): (optionQStyleOptionViewItem.rect.x()-10), midY - 8, crossIconQPixmap.scaled(16, 16, Qt.KeepAspectRatio)) - isUserRow = indexQModelIndex.parent() != indexQModelIndex.parent().parent() if isUserRow: optionQStyleOptionViewItem.rect.setX(optionQStyleOptionViewItem.rect.x()+constants.USERLIST_GUI_USERNAME_OFFSET) if column == constants.USERLIST_GUI_FILENAME_COLUMN: