mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 01:49:42 +02:00
20 lines
761 B
Python
20 lines
761 B
Python
from core.interface.dialogs.theme import _theme_colors
|
|
from PySide6.QtWidgets import QStyledItemDelegate
|
|
from PySide6 import QtWidgets
|
|
|
|
class HoverRowDelegate(QStyledItemDelegate):
|
|
|
|
def paint(self, painter, option, index):
|
|
from core.interface.gui import MainWindow
|
|
|
|
opt = QtWidgets.QStyleOptionViewItem(option)
|
|
option.state &= ~QtWidgets.QStyle.StateFlag.State_HasFocus
|
|
option.state &= ~QtWidgets.QStyle.StateFlag.State_Selected
|
|
|
|
hovered_row = MainWindow._instance._hovered_row if MainWindow._instance else -1
|
|
if index.row() == hovered_row:
|
|
painter.save()
|
|
painter.fillRect(option.rect, _theme_colors()["hover"])
|
|
painter.restore()
|
|
super().paint(painter, opt, index)
|