diff --git a/bouquin/editor.py b/bouquin/editor.py index 7fe55c0..a5b7643 100644 --- a/bouquin/editor.py +++ b/bouquin/editor.py @@ -28,9 +28,11 @@ class Editor(QTextEdit): cursor.mergeCharFormat(fmt) self.mergeCurrentCharFormat(fmt) - @Slot(QFont.Weight) - def apply_weight(self, weight): + @Slot() + def apply_weight(self): + cur = self.currentCharFormat() fmt = QTextCharFormat() + weight = QFont.Weight.Normal if cur.fontWeight() == QFont.Weight.Bold else QFont.Weight.Bold fmt.setFontWeight(weight) self.merge_on_sel(fmt) diff --git a/bouquin/toolbar.py b/bouquin/toolbar.py index 93c7ee3..a3a8cef 100644 --- a/bouquin/toolbar.py +++ b/bouquin/toolbar.py @@ -6,7 +6,7 @@ from PySide6.QtWidgets import QToolBar class ToolBar(QToolBar): - boldRequested = Signal(QFont.Weight) + boldRequested = Signal() italicRequested = Signal() underlineRequested = Signal() strikeRequested = Signal() @@ -24,7 +24,7 @@ class ToolBar(QToolBar): # Bold bold = QAction("Bold", self) bold.setShortcut("Ctrl+B") - bold.triggered.connect(lambda: self.boldRequested.emit(QFont.Weight.Bold)) + bold.triggered.connect(self.boldRequested) italic = QAction("Italic", self) italic.setShortcut("Ctrl+I")