def createHintsGroupBox(self):
self.hintsGroupBox = QGroupBox("Hints")
self.msWindowsFixedSizeDialogCheckBox = self.createCheckBox("MS Windows fixed size dialog")
self.x11BypassWindowManagerCheckBox = self.createCheckBox("X11 bypass window manager")
self.framelessWindowCheckBox = self.createCheckBox("Frameless window")
self.windowTitleCheckBox = self.createCheckBox("Window title")
self.windowSystemMenuCheckBox = self.createCheckBox("Window system menu")
self.windowMinimizeButtonCheckBox = self.createCheckBox("Window minimize button")
self.windowMaximizeButtonCheckBox = self.createCheckBox("Window maximize button")
self.windowCloseButtonCheckBox = self.createCheckBox("Window close button")
self.windowContextHelpButtonCheckBox = self.createCheckBox("Window context help button")
self.windowShadeButtonCheckBox = self.createCheckBox("Window shade button")
self.windowStaysOnTopCheckBox = self.createCheckBox("Window stays on top")
self.windowStaysOnBottomCheckBox = self.createCheckBox("Window stays on bottom")
self.customizeWindowHintCheckBox = self.createCheckBox("Customize window")
layout = QGridLayout()
layout.addWidget(self.msWindowsFixedSizeDialogCheckBox, 0, 0)
layout.addWidget(self.x11BypassWindowManagerCheckBox, 1, 0)
layout.addWidget(self.framelessWindowCheckBox, 2, 0)
layout.addWidget(self.windowTitleCheckBox, 3, 0)
layout.addWidget(self.windowSystemMenuCheckBox, 4, 0)
layout.addWidget(self.windowMinimizeButtonCheckBox, 0, 1)
layout.addWidget(self.windowMaximizeButtonCheckBox, 1, 1)
layout.addWidget(self.windowCloseButtonCheckBox, 2, 1)
layout.addWidget(self.windowContextHelpButtonCheckBox, 3, 1)
layout.addWidget(self.windowShadeButtonCheckBox, 4, 1)
layout.addWidget(self.windowStaysOnTopCheckBox, 5, 1)
layout.addWidget(self.windowStaysOnBottomCheckBox, 6, 1)
layout.addWidget(self.customizeWindowHintCheckBox, 5, 0)
self.hintsGroupBox.setLayout(layout)
python类Window()的实例源码
testwindowflags.py 文件源码
项目:incubator-senssoft-userale-pyqt5
作者: apache
项目源码
文件源码
阅读 26
收藏 0
点赞 0
评论 0
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)
testwindowflags.py 文件源码
项目:incubator-senssoft-userale-pyqt5
作者: apache
项目源码
文件源码
阅读 15
收藏 0
点赞 0
评论 0
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 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 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 __init__(self, preselected_index, message: Message, viewtype: int, parent=None):
super().__init__(parent)
self.ui = Ui_DialogLabels()
self.ui.setupUi(self)
field_types = FieldType.load_from_xml()
self.model = PLabelTableModel(message, field_types)
self.preselected_index = preselected_index
self.ui.tblViewProtoLabels.setItemDelegateForColumn(0, ComboBoxDelegate([ft.caption for ft in field_types],
is_editable=True,
return_index=False, parent=self))
self.ui.tblViewProtoLabels.setItemDelegateForColumn(1, SpinBoxDelegate(1, len(message), self))
self.ui.tblViewProtoLabels.setItemDelegateForColumn(2, SpinBoxDelegate(1, len(message), self))
self.ui.tblViewProtoLabels.setItemDelegateForColumn(3,
ComboBoxDelegate([""] * len(constants.LABEL_COLORS),
colors=constants.LABEL_COLORS,
parent=self))
self.ui.tblViewProtoLabels.setItemDelegateForColumn(4, CheckBoxDelegate(self))
self.ui.tblViewProtoLabels.setModel(self.model)
self.ui.tblViewProtoLabels.selectRow(preselected_index)
self.ui.tblViewProtoLabels.setEditTriggers(QAbstractItemView.AllEditTriggers)
self.ui.tblViewProtoLabels.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
self.ui.tblViewProtoLabels.resizeColumnsToContents()
self.setWindowFlags(Qt.Window)
self.setWindowTitle(self.tr("Edit Protocol Labels from message type %s") % message.message_type.name)
self.configure_special_config_tabs()
self.ui.splitter.setSizes([self.height() / 2, self.height() / 2])
self.create_connects()
self.ui.cbProtoView.setCurrentIndex(viewtype)
self.setAttribute(Qt.WA_DeleteOnClose)
try:
self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__)))
except TypeError:
pass
for i in range(self.model.rowCount()):
self.open_editors(i)
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()