我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用PyQt5.QtCore.Qt.CustomizeWindowHint()。
def __init__(self): super(Recorder, self).__init__() self.setWindowFlags(Qt.CustomizeWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) self.layout_outer = QVBoxLayout() self.widget_inner = QWidget() self.layout_inner = QVBoxLayout() self.layout_bar = QHBoxLayout() self.layout_timer = QHBoxLayout() self.layout_btns = QHBoxLayout() self.widget_inner.setLayout(self.layout_inner) self.layout_outer.addWidget(self.widget_inner) self.layout_inner.addLayout(self.layout_bar) self.layout_inner.addStretch(-1) self.layout_inner.addLayout(self.layout_timer) self.layout_inner.addLayout(self.layout_btns) self.setLayout(self.layout_outer) self.style = """ .QWidget{ background-color: #080f1c; border-radius: 10px; } """ self.screencast_number = 0 self.widget_inner.setStyleSheet(self.style) self.init_bar() self.init_timer() self.init_buttons() self.setFixedWidth(self.btn_size.width()*3+50) self.dir_name = "."
def __init__(self, parent=None, *args, **kwargs): super(WaitDialog, self).__init__(parent) self.label = QLabel(self) self.label.setAlignment(Qt.AlignCenter) self.setFixedSize(551, 401) self.setWindowOpacity(0.5) # set transparent self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint | Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) # background transparent self.setContentsMargins(0, 0, 0, 0) config = Config() self.movie = QMovie(os.path.join(config.images, 'wait.gif')) self.label.setMovie(self.movie) self.movie.start()
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()