From 10572c87462f84e2b1b8418da0e3968bc53b7690 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Dec 2021 08:28:31 +0530 Subject: [PATCH] Fix comments editor dialog not displaying toolbar until resized --- src/calibre/gui2/dialogs/comments_dialog.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/dialogs/comments_dialog.py b/src/calibre/gui2/dialogs/comments_dialog.py index 4e1afe3d20..090025c957 100644 --- a/src/calibre/gui2/dialogs/comments_dialog.py +++ b/src/calibre/gui2/dialogs/comments_dialog.py @@ -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()))