本文整理汇总了Python中PySide2.QtWidgets.QApplication.instance方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.instance方法的具体用法?Python QApplication.instance怎么用?Python QApplication.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets.QApplication
的用法示例。
在下文中一共展示了QApplication.instance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testInstanceObject
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import instance [as 别名]
def testInstanceObject(self):
TestObject.createApp()
app1 = QApplication.instance()
app2 = QApplication.instance()
app1.setObjectName("MyApp")
self.assertEqual(app1, app2)
self.assertEqual(app2.objectName(), app1.objectName())
app1.destroyed.connect(self.appDestroyed)
示例2: createNextWebView
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import instance [as 别名]
def createNextWebView():
global functionID
nListCount = len(FUNCTIONS_LIST) - 1
functionID = functionID + 1
print functionID
if functionID < nListCount:
createWebView( functionID )
else:
QTimer.singleShot(300, QApplication.instance().quit)
示例3: createActions
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import instance [as 别名]
def createActions(self):
self.newAct = QAction(QIcon.fromTheme("document-new", QIcon(':/images/new.png')), "&New", self,
shortcut=QKeySequence.New, statusTip="Create a new file",
triggered=self.newFile)
self.openAct = QAction(QIcon.fromTheme("document-open", QIcon(':/images/open.png')), "&Open...", self,
shortcut=QKeySequence.Open, statusTip="Open an existing file",
triggered=self.open)
self.saveAct = QAction(QIcon.fromTheme("document-save", QIcon(':/images/save.png')), "&Save", self,
shortcut=QKeySequence.Save,
statusTip="Save the document to disk", triggered=self.save)
self.saveAsAct = QAction("Save &As...", self,
shortcut=QKeySequence.SaveAs,
statusTip="Save the document under a new name",
triggered=self.saveAs)
self.exitAct = QAction("E&xit", self, shortcut=QKeySequence.Quit,
statusTip="Exit the application",
triggered=QApplication.instance().closeAllWindows)
self.cutAct = QAction(QIcon.fromTheme("edit-cut", QIcon(':/images/cut.png')), "Cu&t", self,
shortcut=QKeySequence.Cut,
statusTip="Cut the current selection's contents to the clipboard",
triggered=self.cut)
self.copyAct = QAction(QIcon.fromTheme("edit-copy", QIcon(':/images/copy.png')), "&Copy", self,
shortcut=QKeySequence.Copy,
statusTip="Copy the current selection's contents to the clipboard",
triggered=self.copy)
self.pasteAct = QAction(QIcon.fromTheme("edit-paste", QIcon(':/images/paste.png')), "&Paste", self,
shortcut=QKeySequence.Paste,
statusTip="Paste the clipboard's contents into the current selection",
triggered=self.paste)
self.closeAct = QAction("Cl&ose", self,
statusTip="Close the active window",
triggered=self.mdiArea.closeActiveSubWindow)
self.closeAllAct = QAction("Close &All", self,
statusTip="Close all the windows",
triggered=self.mdiArea.closeAllSubWindows)
self.tileAct = QAction("&Tile", self, statusTip="Tile the windows",
triggered=self.mdiArea.tileSubWindows)
self.cascadeAct = QAction("&Cascade", self,
statusTip="Cascade the windows",
triggered=self.mdiArea.cascadeSubWindows)
self.nextAct = QAction("Ne&xt", self, shortcut=QKeySequence.NextChild,
statusTip="Move the focus to the next window",
triggered=self.mdiArea.activateNextSubWindow)
self.previousAct = QAction("Pre&vious", self,
shortcut=QKeySequence.PreviousChild,
statusTip="Move the focus to the previous window",
triggered=self.mdiArea.activatePreviousSubWindow)
self.separatorAct = QAction(self)
self.separatorAct.setSeparator(True)
self.aboutAct = QAction("&About", self,
statusTip="Show the application's About box",
triggered=self.about)
self.aboutQtAct = QAction("About &Qt", self,
statusTip="Show the Qt library's About box",
triggered=QApplication.instance().aboutQt)