macOS: fix selection highlight in MainWindow userList

This commit is contained in:
Alberto Sottile 2019-05-10 23:55:48 +02:00
parent ff6bb74b49
commit ce8884f4c7
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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: