mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-24 07:56:33 +01:00
Make ncols calculation a little more robust
This commit is contained in:
parent
9537bfeff2
commit
d0cf78b717
1 changed files with 3 additions and 4 deletions
|
|
@ -987,9 +987,9 @@ def handle_mouse_press_event(self, ev):
|
|||
def number_of_columns(self):
|
||||
# Number of columns currently visible in the grid
|
||||
if self._ncols is None:
|
||||
step = self.spacing()
|
||||
for y in range(step, 300, step):
|
||||
for x in range(step, 300, step):
|
||||
step = max(10, self.spacing())
|
||||
for y in range(step, 500, step):
|
||||
for x in range(step, 500, step):
|
||||
i = self.indexAt(QPoint(x, y))
|
||||
if i.isValid():
|
||||
for x in range(self.viewport().width() - step, self.viewport().width() - 300, -step):
|
||||
|
|
@ -997,7 +997,6 @@ def number_of_columns(self):
|
|||
if j.isValid():
|
||||
self._ncols = j.row() - i.row() + 1
|
||||
return self._ncols
|
||||
break
|
||||
return self._ncols
|
||||
|
||||
def keyPressEvent(self, ev):
|
||||
|
|
|
|||
Loading…
Reference in a new issue