mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix QV widget not correctly parented when switching layout from one with QV closed to one with QV open
This commit is contained in:
parent
a2c105ea4d
commit
becdf4ef9f
@ -117,6 +117,9 @@ class ShowQuickviewAction(InterfaceAction):
|
|||||||
self.qv_button.blockSignals(True)
|
self.qv_button.blockSignals(True)
|
||||||
self.qv_button.set_state_to_hide()
|
self.qv_button.set_state_to_hide()
|
||||||
self.qv_button.blockSignals(False)
|
self.qv_button.blockSignals(False)
|
||||||
|
self._create_current_instance()
|
||||||
|
|
||||||
|
def _create_current_instance(self):
|
||||||
index = self.gui.library_view.currentIndex()
|
index = self.gui.library_view.currentIndex()
|
||||||
self.current_instance = Quickview(self.gui, index, self.qaction.shortcut(),
|
self.current_instance = Quickview(self.gui, index, self.qaction.shortcut(),
|
||||||
focus_booklist_shortcut=self.focus_bl_action.shortcut())
|
focus_booklist_shortcut=self.focus_bl_action.shortcut())
|
||||||
|
@ -396,10 +396,27 @@ class CentralContainer(QWidget):
|
|||||||
layout = Layout.wide if is_wide else Layout.narrow
|
layout = Layout.wide if is_wide else Layout.narrow
|
||||||
if layout is self.layout:
|
if layout is self.layout:
|
||||||
return False
|
return False
|
||||||
|
ss = self.serialized_settings()
|
||||||
|
before = ss[self.layout.name + '_visibility']
|
||||||
|
after = ss[layout.name + '_visibility']
|
||||||
gui.book_details.vertical = is_wide
|
gui.book_details.vertical = is_wide
|
||||||
self.layout = layout
|
self.layout = layout
|
||||||
self.write_settings()
|
self.write_settings()
|
||||||
self.relayout()
|
# apply visibility changes by clicking buttons to ensure button
|
||||||
|
# state is correct and also deals with the case of the QV widget not
|
||||||
|
# being initialised
|
||||||
|
changes = set()
|
||||||
|
if before != after:
|
||||||
|
for k in before:
|
||||||
|
if before[k] != after[k]:
|
||||||
|
changes.add(k)
|
||||||
|
setattr(self.is_visible, k, before[k])
|
||||||
|
if changes:
|
||||||
|
for k in changes:
|
||||||
|
button = getattr(self, k + '_button')
|
||||||
|
button.click()
|
||||||
|
else:
|
||||||
|
self.relayout()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def serialized_settings(self):
|
def serialized_settings(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user