mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Grid View: Do not render covers while user is using slider on scrollbar
This commit is contained in:
parent
d9ab10dd16
commit
6ce79b2d96
@ -468,6 +468,39 @@ class GridView(QListView):
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
self.gui = parent
|
||||
self.context_menu = None
|
||||
self.verticalScrollBar().sliderPressed.connect(self.slider_pressed)
|
||||
self.verticalScrollBar().sliderReleased.connect(self.slider_released)
|
||||
|
||||
@property
|
||||
def first_visible_row(self):
|
||||
geom = self.viewport().geometry()
|
||||
for y in xrange(geom.top(), (self.spacing()*2) + geom.top(), 5):
|
||||
for x in xrange(geom.left(), (self.spacing()*2) + geom.left(), 5):
|
||||
ans = self.indexAt(QPoint(x, y)).row()
|
||||
if ans > -1:
|
||||
return ans
|
||||
|
||||
@property
|
||||
def last_visible_row(self):
|
||||
geom = self.viewport().geometry()
|
||||
for y in xrange(geom.bottom(), geom.bottom() - 2 * self.spacing(), -5):
|
||||
for x in xrange(geom.left(), (self.spacing()*2) + geom.left(), 5):
|
||||
ans = self.indexAt(QPoint(x, y)).row()
|
||||
if ans > -1:
|
||||
item_width = self.delegate.item_size.width() + 2*self.spacing()
|
||||
return ans + (geom.width() // item_width)
|
||||
|
||||
def update_viewport(self):
|
||||
m = self.model()
|
||||
for r in xrange(self.first_visible_row or 0, self.last_visible_row or (m.count() - 1)):
|
||||
self.update(m.index(r, 0))
|
||||
|
||||
def slider_pressed(self):
|
||||
self.ignore_render_requests.set()
|
||||
|
||||
def slider_released(self):
|
||||
self.ignore_render_requests.clear()
|
||||
self.update_viewport()
|
||||
|
||||
def double_clicked(self, index):
|
||||
d = self.delegate
|
||||
|
Loading…
x
Reference in New Issue
Block a user