我们从Python开源项目中,提取了以下18个代码示例,用于说明如何使用PyQt5.QtCore.Qt.WindowStaysOnTopHint()。
def __init__(self, parent=None): super().__init__() self.setFixedSize(950, 580) self.setWindowTitle(self.tr("Lime GNU/Linux System Installer")) self.setWindowIcon(QIcon(":/images/lilii-logo.svg")) self.setWindowFlags(Qt.WindowTitleHint|Qt.WindowMinimizeButtonHint) #Qt.WindowStaysOnTopHint x, y = (QDesktopWidget().width()-self.width())/2, (QDesktopWidget().availableGeometry().height()-self.height())/2 self.move(x, y) layout = QVBoxLayout() self.setLayout(layout) self.wizardWidget = QStackedWidget() self.wizardWidget.addWidget(WelcomeWidget(self)) self.wizardWidget.addWidget(LocationWidget(self)) self.wizardWidget.addWidget(KeyboardWidget(self)) self.wizardWidget.addWidget(PartitionWidget(self)) self.wizardWidget.addWidget(UserWidget(self)) self.wizardWidget.addWidget(SummaryWidget(self)) self.wizardWidget.addWidget(InstallWidget(self)) self.wizardWidget.addWidget(FinishWidget(self)) self.titleWidget = TitleWidget(self.wizardWidget) self.footerWidget = FooterWidget(self.wizardWidget) layout.addWidget(self.titleWidget) layout.addWidget(self.wizardWidget) layout.addWidget(self.footerWidget) self.footerWidget.cancelButton.clicked.connect(self.close) self.wizardWidget.widget(4).applyPage.connect(self.footerWidget.continueButton.setEnabled) self.wizardWidget.widget(3).applyPage.connect(self.footerWidget.continueButton.setEnabled) self.wizardWidget.widget(6).applyPage.connect(self.footerWidget.continueButton.setEnabled)
def __init__(self, parent=None): super(LanguageChooser, self).__init__(parent, Qt.WindowStaysOnTopHint) self.qmFileForCheckBoxMap = {} self.mainWindowForCheckBoxMap = {} groupBox = QGroupBox("Languages") groupBoxLayout = QGridLayout() qmFiles = self.findQmFiles() for i, qmf in enumerate(qmFiles): checkBox = QCheckBox(self.languageName(qmf)) self.qmFileForCheckBoxMap[checkBox] = qmf checkBox.toggled.connect(self.checkBoxToggled) groupBoxLayout.addWidget(checkBox, i / 2, i % 2) groupBox.setLayout(groupBoxLayout) buttonBox = QDialogButtonBox() showAllButton = buttonBox.addButton("Show All", QDialogButtonBox.ActionRole) hideAllButton = buttonBox.addButton("Hide All", QDialogButtonBox.ActionRole) showAllButton.clicked.connect(self.showAll) hideAllButton.clicked.connect(self.hideAll) mainLayout = QVBoxLayout() mainLayout.addWidget(groupBox) mainLayout.addWidget(buttonBox) self.setLayout(mainLayout) self.setWindowTitle("I18N")
def __init__(self, app): super().__init__(None, Qt.WindowStaysOnTopHint) self.init_ui() self.set_communication() self.set_clipboard(app) self.set_translation() self.show_info('????')
def __init__(self, min_splash_time=2): """ Initialize the B3 splash screen. :param min_splash_time: the minimum amount of seconds the splash screen should be drawn. """ self.splash_pix = QPixmap(B3_SPLASH) self.min_splash_time = time() + min_splash_time QSplashScreen.__init__(self, self.splash_pix, Qt.WindowStaysOnTopHint) self.setMask(self.splash_pix.mask())
def main(): app = QApplication(sys.argv) app.setStyle('cleanlooks') app.setApplicationName("Linguistica") # Get screen resolution # Why do we need to know screen resolution? # Because this information is useful for setting the size of particular # widgets, e.g., the webview for visualizing the word neighbor manifold # (the bigger the webview size, the better it is for visualization!) resolution = app.desktop().screenGeometry() screen_width = resolution.width() screen_height = resolution.height() # create and display splash screen splash_image_path = os.path.join(os.path.dirname(__file__), 'lxa_splash_screen.png') splash_image = QPixmap(splash_image_path) splash_screen = QSplashScreen(splash_image, Qt.WindowStaysOnTopHint) splash_screen.setMask(splash_image.mask()) splash_screen.show() app.processEvents() time.sleep(2) # launch graphical user interface form = MainWindow(screen_height, screen_width, __version__) form.show() splash_screen.finish(form) app.exec_()
def setWindowFlags(self, flags): super(PreviewWindow, self).setWindowFlags(flags) flag_type = (flags & Qt.WindowType_Mask) if flag_type == Qt.Window: text = "Qt.Window" elif flag_type == Qt.Dialog: text = "Qt.Dialog" elif flag_type == Qt.Sheet: text = "Qt.Sheet" elif flag_type == Qt.Drawer: text = "Qt.Drawer" elif flag_type == Qt.Popup: text = "Qt.Popup" elif flag_type == Qt.Tool: text = "Qt.Tool" elif flag_type == Qt.ToolTip: text = "Qt.ToolTip" elif flag_type == Qt.SplashScreen: text = "Qt.SplashScreen" else: text = "" if flags & Qt.MSWindowsFixedSizeDialogHint: text += "\n| Qt.MSWindowsFixedSizeDialogHint" if flags & Qt.X11BypassWindowManagerHint: text += "\n| Qt.X11BypassWindowManagerHint" if flags & Qt.FramelessWindowHint: text += "\n| Qt.FramelessWindowHint" if flags & Qt.WindowTitleHint: text += "\n| Qt.WindowTitleHint" if flags & Qt.WindowSystemMenuHint: text += "\n| Qt.WindowSystemMenuHint" if flags & Qt.WindowMinimizeButtonHint: text += "\n| Qt.WindowMinimizeButtonHint" if flags & Qt.WindowMaximizeButtonHint: text += "\n| Qt.WindowMaximizeButtonHint" if flags & Qt.WindowCloseButtonHint: text += "\n| Qt.WindowCloseButtonHint" if flags & Qt.WindowContextHelpButtonHint: text += "\n| Qt.WindowContextHelpButtonHint" if flags & Qt.WindowShadeButtonHint: text += "\n| Qt.WindowShadeButtonHint" if flags & Qt.WindowStaysOnTopHint: text += "\n| Qt.WindowStaysOnTopHint" if flags & Qt.WindowStaysOnBottomHint: text += "\n| Qt.WindowStaysOnBottomHint" if flags & Qt.CustomizeWindowHint: text += "\n| Qt.CustomizeWindowHint" self.textEdit.setPlainText(text)
def updatePreview(self): flags = Qt.WindowFlags() if self.windowRadioButton.isChecked(): flags = Qt.Window elif self.dialogRadioButton.isChecked(): flags = Qt.Dialog elif self.sheetRadioButton.isChecked(): flags = Qt.Sheet elif self.drawerRadioButton.isChecked(): flags = Qt.Drawer elif self.popupRadioButton.isChecked(): flags = Qt.Popup elif self.toolRadioButton.isChecked(): flags = Qt.Tool elif self.toolTipRadioButton.isChecked(): flags = Qt.ToolTip elif self.splashScreenRadioButton.isChecked(): flags = Qt.SplashScreen if self.msWindowsFixedSizeDialogCheckBox.isChecked(): flags |= Qt.MSWindowsFixedSizeDialogHint if self.x11BypassWindowManagerCheckBox.isChecked(): flags |= Qt.X11BypassWindowManagerHint if self.framelessWindowCheckBox.isChecked(): flags |= Qt.FramelessWindowHint if self.windowTitleCheckBox.isChecked(): flags |= Qt.WindowTitleHint if self.windowSystemMenuCheckBox.isChecked(): flags |= Qt.WindowSystemMenuHint if self.windowMinimizeButtonCheckBox.isChecked(): flags |= Qt.WindowMinimizeButtonHint if self.windowMaximizeButtonCheckBox.isChecked(): flags |= Qt.WindowMaximizeButtonHint if self.windowCloseButtonCheckBox.isChecked(): flags |= Qt.WindowCloseButtonHint if self.windowContextHelpButtonCheckBox.isChecked(): flags |= Qt.WindowContextHelpButtonHint if self.windowShadeButtonCheckBox.isChecked(): flags |= Qt.WindowShadeButtonHint if self.windowStaysOnTopCheckBox.isChecked(): flags |= Qt.WindowStaysOnTopHint if self.windowStaysOnBottomCheckBox.isChecked(): flags |= Qt.WindowStaysOnBottomHint if self.customizeWindowHintCheckBox.isChecked(): flags |= Qt.CustomizeWindowHint self.previewWindow.setWindowFlags(flags) pos = self.previewWindow.pos() if pos.x() < 0: pos.setX(0) if pos.y() < 0: pos.setY(0) self.previewWindow.move(pos) self.previewWindow.show()
def main(args=None): if args is None: args = sys.argv[:] user_options = Options() options = user_options.parse_args(args[1:]) signal.signal(signal.SIGINT, sigint_handler) app = QW.QApplication(sys.argv) filename = sequana_data("drawing.png", "../gui") if options.nosplash: app.processEvents() sequana = SequanaGUI(user_options=options) sequana.show() else: # Show the splash screen for a few seconds splash_pix = QtGui.QPixmap(filename) splash = QW.QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() for i in range(0, 100): t = time.time() while time.time() < t + 0.5/100.: app.processEvents() app.processEvents() sequana = SequanaGUI(user_options=options) sequana.show() splash.finish(sequana) # Make sure the main window is the active one sequana.raise_() sequana.activateWindow() sys.exit(app.exec_())
def __init__(self,parent): QToolBar.__init__(self) #aaa=self.readStyleSheet(os.path.join(get_css_path(),"menu.css")) #aaa=str(aaa,'utf-8') #self.setStyleSheet(aaa) self.setToolButtonStyle( Qt.ToolButtonTextBesideIcon) self.setOrientation(Qt.Vertical) #self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint|Qt.WindowStaysOnTopHint) self.setIconSize(QSize(42, 42)) self.configure_configwindow = QAction(QIcon_load("help"), _("Help window"), self) self.addAction(self.configure_configwindow) self.configure_configwindow = QAction(QIcon_load("help"), _("Manual"), self) self.addAction(self.configure_configwindow) self.configure_configwindow = QAction(QIcon_load("help"), _("License"), self) self.addAction(self.configure_configwindow) self.configure_configwindow = QAction(QIcon_load("help"), _("Youtube"), self) self.addAction(self.configure_configwindow) self.configure_configwindow = QAction(QIcon_load("help"), _("Citing the model"), self) self.addAction(self.configure_configwindow) self.configure_configwindow = QAction(QIcon_load("help"), _("About"), self) self.addAction(self.configure_configwindow) l=self.layout() for i in range(0,l.count()): l.itemAt(i).setAlignment(Qt.AlignLeft) self.installEventFilter(self) self.setWindowFlags(Qt.Popup) self.move(self.mapFromGlobal(QCursor.pos()))
def main(argv=[]): currentExitCode = EXIT_CODE_REBOOT while currentExitCode == EXIT_CODE_REBOOT: app = QApplication([]) if getattr(sys, 'frozen', False): # frozen dir_ = os.path.dirname(sys.executable) else: # unfrozen dir_ = os.path.dirname(os.path.realpath(__file__)) # IMG_PATH = IMG_PATH.append(os.path.join(dir_, 'images')) # Create and display the splash screen splash_pix = QPixmap(os.path.join(dir_, './rrpam_wds/gui/images/splash_screen.png')) if (splash_pix is None): pass splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) # splash.setMask(splash_pix.mask()) splash.show() import time start = time.time() while time.time() - start < .5: time.sleep(0.001) app.processEvents() from rrpam_wds.gui.dialogs import MainWindow from guidata.configtools import get_icon app.setWindowIcon(get_icon("main_logo.png")) if (len(argv) > 1 and argv[1] == TESTARG): # pragma: no cover # first run tests win = MainWindow() import rrpam_wds.tests.test_optimal_time_graph as og og.main(og.TC, test=False, mainwindow=win) win = None win = MainWindow() import rrpam_wds.tests.test_main_window as mw mw.main(mw.TC, test=False, mainwindow=win) win = None time.sleep(3) app.processEvents() time.sleep(1) win = MainWindow() win.show() if(splash): splash.finish(win) splash = None currentExitCode = app.exec_() app = None time.sleep(0.1)