mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #790
This commit is contained in:
parent
cf3bb47fc3
commit
e5214e3f39
@ -8,8 +8,8 @@ from math import cos, sin, pi
|
|||||||
from itertools import repeat
|
from itertools import repeat
|
||||||
from PyQt4.QtGui import QTableView, QProgressDialog, QAbstractItemView, QColor, \
|
from PyQt4.QtGui import QTableView, QProgressDialog, QAbstractItemView, QColor, \
|
||||||
QItemDelegate, QPainterPath, QLinearGradient, QBrush, \
|
QItemDelegate, QPainterPath, QLinearGradient, QBrush, \
|
||||||
QPen, QStyle, QPainter, QLineEdit, QApplication, \
|
QPen, QStyle, QPainter, QLineEdit, \
|
||||||
QPalette, QImage, QStyleOptionFocusRect, QApplication
|
QPalette, QImage, QApplication
|
||||||
from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt, QString, \
|
from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt, QString, \
|
||||||
QCoreApplication, SIGNAL, QObject, QSize, QModelIndex, \
|
QCoreApplication, SIGNAL, QObject, QSize, QModelIndex, \
|
||||||
QTimer
|
QTimer
|
||||||
@ -55,7 +55,10 @@ class LibraryDelegate(QItemDelegate):
|
|||||||
painter.restore()
|
painter.restore()
|
||||||
|
|
||||||
painter.save()
|
painter.save()
|
||||||
|
if hasattr(QStyle, 'CE_ItemViewItem'):
|
||||||
QApplication.style().drawControl(QStyle.CE_ItemViewItem, option, painter)
|
QApplication.style().drawControl(QStyle.CE_ItemViewItem, option, painter)
|
||||||
|
elif option.state & QStyle.State_Selected:
|
||||||
|
painter.fillRect(option.rect, option.palette.highlight())
|
||||||
try:
|
try:
|
||||||
painter.setRenderHint(QPainter.Antialiasing)
|
painter.setRenderHint(QPainter.Antialiasing)
|
||||||
y = option.rect.center().y()-self.SIZE/2.
|
y = option.rect.center().y()-self.SIZE/2.
|
||||||
|
@ -143,7 +143,7 @@ class LocationDelegate(QAbstractItemDelegate):
|
|||||||
def paint(self, painter, option, index):
|
def paint(self, painter, option, index):
|
||||||
style = QApplication.style()
|
style = QApplication.style()
|
||||||
painter.save()
|
painter.save()
|
||||||
if hasattr(QStyle.CE_ItemViewItem):
|
if hasattr(QStyle, 'CE_ItemViewItem'):
|
||||||
QApplication.style().drawControl(QStyle.CE_ItemViewItem, option, painter)
|
QApplication.style().drawControl(QStyle.CE_ItemViewItem, option, painter)
|
||||||
highlight = getattr(index.model(), 'highlight_row', -1) == index.row()
|
highlight = getattr(index.model(), 'highlight_row', -1) == index.row()
|
||||||
mode = QIcon.Active if highlight else QIcon.Normal
|
mode = QIcon.Active if highlight else QIcon.Normal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user