本文整理汇总了Python中PySide2.QtWidgets.QMainWindow方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QMainWindow方法的具体用法?Python QtWidgets.QMainWindow怎么用?Python QtWidgets.QMainWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QMainWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: qui_menubar
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
#=======================================
# ui creation functions
#=======================================
示例2: qui_menubar
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
# compatible hold function
示例3: _open_item_tracker
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def _open_item_tracker(self):
# Importing this at root level seems to crash linux tests :(
from PySide2.QtWebEngineWidgets import QWebEngineView
tracker_window = QMainWindow()
tracker_window.setWindowTitle("Item Tracker")
tracker_window.resize(370, 380)
web_view = QWebEngineView(tracker_window)
tracker_window.setCentralWidget(web_view)
self.web_view = web_view
def update_window_icon():
tracker_window.setWindowIcon(web_view.icon())
web_view.iconChanged.connect(update_window_icon)
web_view.load(QUrl("https://spaghettitoastbook.github.io/echoes/tracker/"))
tracker_window.show()
self._item_tracker_window = tracker_window
# Difficulties stuff
示例4: test_load_ui_customwidget
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def test_load_ui_customwidget():
"""Tests to see if loadUi loads a custom widget properly"""
import sys
from Qt import QtWidgets, QtCompat
app = QtWidgets.QApplication(sys.argv)
win = QtWidgets.QMainWindow()
QtCompat.loadUi(self.ui_qcustomwidget, win)
# Ensure that the derived class was properly created
# and not the base class (in case of failure)
custom_class_name = getattr(win, "customwidget", None).__class__.__name__
excepted_class_name = CustomWidget(win).__class__.__name__
assert custom_class_name == excepted_class_name, \
"loadUi could not load custom widget to main window"
app.exit()
示例5: _init_widgets
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def _init_widgets(self):
window = QMainWindow()
window.setWindowFlags(Qt.Widget)
# pseudo code text box
self._textedit = QCCodeEdit(self)
self._textedit.setTextInteractionFlags(Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse)
self._textedit.setLineWrapMode(QCCodeEdit.NoWrap)
textedit_dock = QDockWidget('Code', self._textedit)
window.setCentralWidget(textedit_dock)
textedit_dock.setWidget(self._textedit)
# decompilation
self._options = QDecompilationOptions(self, self.workspace.instance, options=None)
options_dock = QDockWidget('Decompilation Options', self._options)
window.addDockWidget(Qt.RightDockWidgetArea, options_dock)
options_dock.setWidget(self._options)
layout = QHBoxLayout()
layout.addWidget(window)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
示例6: getMayaMainWindow
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def getMayaMainWindow():
from PySide2 import QtWidgets
from maya import OpenMayaUI
from shiboken2 import wrapInstance
mayaMainWindow = OpenMayaUI.MQtUtil.mainWindow()
return wrapInstance(long(mayaMainWindow), QtWidgets.QMainWindow)
示例7: getMayaMainWindow
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def getMayaMainWindow():
mayaMainWindow = OpenMayaUI.MQtUtil.mainWindow()
return wrapInstance(long(mayaMainWindow), QtWidgets.QMainWindow)
示例8: getMayaWindow
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def getMayaWindow():
""" Get main window pointer """
ptr = OpenMayaUI.MQtUtil.mainWindow()
return shiboken2.wrapInstance(long(ptr), QtWidgets.QMainWindow)
示例9: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def __init__(self, parent):
if not isinstance(parent, QtWidgets.QMainWindow):
raise TypeError('parent must be a MainWindow instance')
self.parent = parent
示例10: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def __init__(self, parent=None, mode=0):
UniversalToolUI.__init__(self, parent)
# class variables
self.version= version
self.date = date
self.log = log
self.help = help
# mode: example for receive extra user input as parameter
self.mode = 0
if mode in [0,1]:
self.mode = mode # mode validator
# Custom user variable
#------------------------------
# initial data
#------------------------------
self.memoData['data']=[]
self.memoData['settingUI']=[]
self.qui_user_dict = {} # e.g: 'edit': 'LNTextEdit',
self.setupStyle()
if isinstance(self, QtWidgets.QMainWindow):
self.setupMenu()
self.setupWin()
self.setupUI()
self.Establish_Connections()
self.loadLang()
self.loadData()
#------------------------------
# overwrite functions
#------------------------------
示例11: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
main_widget = QtWidgets.QWidget()
self.setCentralWidget(main_widget)
main_layout = QtWidgets.QVBoxLayout()
main_widget.setLayout(main_layout)
示例12: qui_menubar
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
示例13: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def __init__(self, parent=None, mode=0):
UniversalToolUI.__init__(self, parent)
# class variables
self.version= version
self.date = date
self.log = log
self.help = help
# mode: example for receive extra user input as parameter
self.mode = 0
if mode in [0,1]:
self.mode = mode # mode validator
# Custom user variable
#------------------------------
# initial data
#------------------------------
self.memoData['data']=[]
self.memoData['settingUI']=[]
self.qui_user_dict = {} # e.g: 'edit': 'LNTextEdit',
if isinstance(self, QtWidgets.QMainWindow):
self.setupMenu()
self.setupWin()
self.setupUI()
self.Establish_Connections()
self.loadLang()
self.loadData()
#------------------------------
# overwrite functions
#------------------------------
示例14: setupUI
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def setupUI(self, layout='grid'):
#------------------------------
# main_layout auto creation for holding all the UI elements
#------------------------------
main_layout = None
if isinstance(self, QtWidgets.QMainWindow):
main_widget = QtWidgets.QWidget()
self.setCentralWidget(main_widget)
main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
main_widget.setLayout(main_layout)
else:
# main_layout for QDialog
main_layout = self.quickLayout(layout, 'main_layout')
self.setLayout(main_layout)
示例15: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QMainWindow [as 别名]
def __init__(self, parent=None, mode=0):
UniversalToolUI.__init__(self, parent)
# class variables
self.version= version
self.date = date
self.log = log
self.help = help
# mode: example for receive extra user input as parameter
self.mode = 0
if mode in [0,1]:
self.mode = mode # mode validator
# Custom user variable
#------------------------------
# initial data
#------------------------------
self.memoData['data']=[]
self.qui_user_dict = {} # e.g: 'edit': 'LNTextEdit',
self.setupStyle()
if isinstance(self, QtWidgets.QMainWindow):
self.setupMenu()
self.setupWin()
self.setupUI()
self.Establish_Connections()
self.loadLang()
self.loadData()
#------------------------------
# overwrite functions
#------------------------------