Fix comments editor dialog not displaying toolbar until resized

This commit is contained in:
Kovid Goyal 2021-12-04 08:28:31 +05:30
parent 0ef264056f
commit 10572c8746
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -7,7 +7,7 @@ __license__ = 'GPL v3'
from qt.core import (
QApplication, QDialog, QDialogButtonBox, QPlainTextEdit, QSize, Qt,
QVBoxLayout
QVBoxLayout, QTimer
)
from calibre.gui2 import Application, gprefs
@ -46,11 +46,13 @@ class CommentsDialog(QDialog):
QApplication.instance().safe_restore_geometry(self, geom)
else:
self.resize(self.sizeHint())
QTimer.singleShot(0, self.update_geometry)
def update_geometry(self):
self.textbox.toolbar.updateGeometry()
def sizeHint(self):
ans = super().sizeHint()
ans.setWidth(500), ans.setHeight(600)
return ans
return QSize(650, 600)
def save_geometry(self):
gprefs.set('comments_dialog_geom', bytearray(self.saveGeometry()))