diff --git a/LunaTranslator/LunaTranslator/gui/inputdialog.py b/LunaTranslator/LunaTranslator/gui/inputdialog.py index 7fc24167..3b73df43 100644 --- a/LunaTranslator/LunaTranslator/gui/inputdialog.py +++ b/LunaTranslator/LunaTranslator/gui/inputdialog.py @@ -171,9 +171,9 @@ class voiceselect(LDialog): self.setWindowTitle("选择声音") self.setWindowFlags( self.windowFlags() - & ~Qt.WindowContextHelpButtonHint + & ~Qt.WindowType.WindowContextHelpButtonHint & ~Qt.WindowType.WindowCloseButtonHint - | Qt.WindowStaysOnTopHint + | Qt.WindowType.WindowStaysOnTopHint ) _layout = LFormLayout(self) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 948dcb13..9da995ea 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -849,6 +849,8 @@ class TranslatorWindow(resizableframeless): # icon.addPixmap(QPixmap('./files/luna.png'), QIcon.Normal, QIcon.On) self.setWindowIcon(icon) self.firstshow = True + if globalconfig['keepontop']: + self.setWindowFlag(Qt.WindowType.WindowStaysOnTopHint) self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) self.setAttribute(Qt.WidgetAttribute.WA_ShowWithoutActivating, True) self.setWindowTitle("LunaTranslator") diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 96f2dc8d..13049946 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -769,9 +769,9 @@ class Prompt_dialog(LDialog): super().__init__(parent) self.setWindowFlags( self.windowFlags() - & ~Qt.WindowContextHelpButtonHint + & ~Qt.WindowType.WindowContextHelpButtonHint & ~Qt.WindowType.WindowCloseButtonHint - | Qt.WindowStaysOnTopHint + | Qt.WindowType.WindowStaysOnTopHint ) self.setWindowTitle(title) self.setWindowIcon(qtawesome.icon("fa-question"))