mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Book list splitview: Fix horizontal scroll position of split view can change when changing the current column in one view.
Merge branch 'master' of https://github.com/JimmXinu/calibre
This commit is contained in:
commit
6dc5ba94a7
@ -121,8 +121,8 @@ class HeaderView(QHeaderView): # {{{
|
|||||||
|
|
||||||
painter.save()
|
painter.save()
|
||||||
if (
|
if (
|
||||||
(opt.orientation == Qt.Horizontal and sm.currentIndex().column() == logical_index) or
|
(opt.orientation == Qt.Horizontal and sm.currentIndex().column() == logical_index) or (
|
||||||
(opt.orientation == Qt.Vertical and sm.currentIndex().row() == logical_index)):
|
opt.orientation == Qt.Vertical and sm.currentIndex().row() == logical_index)):
|
||||||
painter.setFont(self.current_font)
|
painter.setFont(self.current_font)
|
||||||
self.style().drawControl(QStyle.CE_Header, opt, painter, self)
|
self.style().drawControl(QStyle.CE_Header, opt, painter, self)
|
||||||
painter.restore()
|
painter.restore()
|
||||||
@ -346,9 +346,12 @@ class BooksView(QTableView): # {{{
|
|||||||
dest.selectionModel().select(src.selectionModel().selection(), QItemSelectionModel.ClearAndSelect)
|
dest.selectionModel().select(src.selectionModel().selection(), QItemSelectionModel.ClearAndSelect)
|
||||||
ci = dest.currentIndex()
|
ci = dest.currentIndex()
|
||||||
nci = src.selectionModel().currentIndex()
|
nci = src.selectionModel().currentIndex()
|
||||||
|
# Save/restore horz scroll. ci column may be scrolled out of view.
|
||||||
|
hpos = dest.horizontalScrollBar().value()
|
||||||
if ci.isValid():
|
if ci.isValid():
|
||||||
nci = dest.model().index(nci.row(), ci.column())
|
nci = dest.model().index(nci.row(), ci.column())
|
||||||
dest.selectionModel().setCurrentIndex(nci, QItemSelectionModel.NoUpdate)
|
dest.selectionModel().setCurrentIndex(nci, QItemSelectionModel.NoUpdate)
|
||||||
|
dest.horizontalScrollBar().setValue(hpos)
|
||||||
self.allow_mirroring = True
|
self.allow_mirroring = True
|
||||||
|
|
||||||
def mirror_vscroll(self, src, *a):
|
def mirror_vscroll(self, src, *a):
|
||||||
@ -424,9 +427,7 @@ class BooksView(QTableView): # {{{
|
|||||||
ac.setCheckable(True)
|
ac.setCheckable(True)
|
||||||
ac.setChecked(True)
|
ac.setChecked(True)
|
||||||
if col not in ('ondevice', 'inlibrary') and \
|
if col not in ('ondevice', 'inlibrary') and \
|
||||||
(not self.model().is_custom_column(col) or
|
(not self.model().is_custom_column(col) or self.model().custom_columns[col]['datatype'] not in ('bool',)):
|
||||||
self.model().custom_columns[col]['datatype'] not in ('bool',
|
|
||||||
)):
|
|
||||||
m = ans.addMenu(_('Change text alignment for %s') % name)
|
m = ans.addMenu(_('Change text alignment for %s') % name)
|
||||||
al = self._model.alignment_map.get(col, 'left')
|
al = self._model.alignment_map.get(col, 'left')
|
||||||
for x, t in (('left', _('Left')), ('right', _('Right')), ('center', _('Center'))):
|
for x, t in (('left', _('Left')), ('right', _('Right')), ('center', _('Center'))):
|
||||||
@ -1255,8 +1256,7 @@ class DeviceBooksView(BooksView): # {{{
|
|||||||
md.setUrls([QUrl.fromLocalFile(p) for p in paths])
|
md.setUrls([QUrl.fromLocalFile(p) for p in paths])
|
||||||
drag = QDrag(self)
|
drag = QDrag(self)
|
||||||
drag.setMimeData(md)
|
drag.setMimeData(md)
|
||||||
cover = self.drag_icon(m.cover(self.currentIndex().row()), len(paths) >
|
cover = self.drag_icon(m.cover(self.currentIndex().row()), len(paths) > 1)
|
||||||
1)
|
|
||||||
drag.setHotSpot(QPoint(-15, -15))
|
drag.setHotSpot(QPoint(-15, -15))
|
||||||
drag.setPixmap(cover)
|
drag.setPixmap(cover)
|
||||||
return drag
|
return drag
|
||||||
|
Loading…
x
Reference in New Issue
Block a user