mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-30 18:45:20 -04:00
Nicer cursor handling for ToC panel in the viewer
This commit is contained in:
@@ -17,9 +17,9 @@ class TOCView(QTreeView):
|
||||
|
||||
def __init__(self, *args):
|
||||
QTreeView.__init__(self, *args)
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
self.setMinimumWidth(80)
|
||||
self.header().close()
|
||||
self.setMouseTracking(True)
|
||||
self.setStyleSheet('''
|
||||
QTreeView {
|
||||
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):
|
||||
|
||||
def __init__(self, spine, toc, depth, all_items, parent=None):
|
||||
|
||||
Reference in New Issue
Block a user