mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer cursor handling for ToC panel in the viewer
This commit is contained in:
parent
af854628be
commit
bb1a9b70f1
@ -17,9 +17,9 @@ class TOCView(QTreeView):
|
|||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
QTreeView.__init__(self, *args)
|
QTreeView.__init__(self, *args)
|
||||||
self.setCursor(Qt.PointingHandCursor)
|
|
||||||
self.setMinimumWidth(80)
|
self.setMinimumWidth(80)
|
||||||
self.header().close()
|
self.header().close()
|
||||||
|
self.setMouseTracking(True)
|
||||||
self.setStyleSheet('''
|
self.setStyleSheet('''
|
||||||
QTreeView {
|
QTreeView {
|
||||||
background-color: palette(window);
|
background-color: palette(window);
|
||||||
@ -40,6 +40,13 @@ class TOCView(QTreeView):
|
|||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
def mouseMoveEvent(self, ev):
|
||||||
|
if self.indexAt(ev.pos()).isValid():
|
||||||
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
|
else:
|
||||||
|
self.unsetCursor()
|
||||||
|
return QTreeView.mouseMoveEvent(self, ev)
|
||||||
|
|
||||||
class TOCItem(QStandardItem):
|
class TOCItem(QStandardItem):
|
||||||
|
|
||||||
def __init__(self, spine, toc, depth, all_items, parent=None):
|
def __init__(self, spine, toc, depth, all_items, parent=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user