mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix comments editor toolbars not appearing after a hide/show toggle
Also, move the initial creation update geometry call into the comments edit widget itself
This commit is contained in:
parent
08792b74df
commit
869f556365
@ -15,7 +15,7 @@ from qt.core import (
|
||||
QDialog, QDialogButtonBox, QFont, QFontInfo, QFontMetrics, QFormLayout, QIcon,
|
||||
QKeySequence, QLabel, QLineEdit, QMenu, QPalette, QPlainTextEdit, QPushButton,
|
||||
QSize, QSyntaxHighlighter, Qt, QTabWidget, QTextBlockFormat, QTextCharFormat,
|
||||
QTextCursor, QTextEdit, QTextFormat, QTextListFormat, QToolButton, QUrl,
|
||||
QTextCursor, QTextEdit, QTextFormat, QTextListFormat, QTimer, QToolButton, QUrl,
|
||||
QVBoxLayout, QWidget, pyqtSignal, pyqtSlot
|
||||
)
|
||||
|
||||
@ -1139,6 +1139,7 @@ class Editor(QWidget): # {{{
|
||||
ac = getattr(self.editor, 'action_align_'+x)
|
||||
self.toolbar.add_action(ac)
|
||||
self.toolbar.add_separator()
|
||||
QTimer.singleShot(0, self.toolbar.updateGeometry)
|
||||
|
||||
self.code_edit.textChanged.connect(self.code_dirtied)
|
||||
self.editor.data_changed.connect(self.wyswyg_dirtied)
|
||||
@ -1186,6 +1187,7 @@ class Editor(QWidget): # {{{
|
||||
|
||||
def show_toolbars(self):
|
||||
self.toolbar.setVisible(True)
|
||||
QTimer.singleShot(0, self.toolbar.updateGeometry)
|
||||
|
||||
def toggle_toolbars(self):
|
||||
visible = self.toolbars_visible
|
||||
|
@ -7,7 +7,7 @@ __license__ = 'GPL v3'
|
||||
|
||||
from qt.core import (
|
||||
QApplication, QDialog, QDialogButtonBox, QPlainTextEdit, QSize, Qt,
|
||||
QVBoxLayout, QTimer
|
||||
QVBoxLayout
|
||||
)
|
||||
|
||||
from calibre.gui2 import Application, gprefs
|
||||
@ -46,10 +46,6 @@ 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):
|
||||
return QSize(650, 600)
|
||||
|
Loading…
x
Reference in New Issue
Block a user