aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/doc/codesnippets/examples/mainwindows
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2021-03-24 22:33:35 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-26 20:33:58 +0000
commita1392626572cc661b21b2bf622c4b381ce698d06 (patch)
tree6f7bd0bf8b57cafcb83dcb89fe7d5c0900bed091 /sources/pyside6/doc/codesnippets/examples/mainwindows
parent1972fd80fe358967f500c9fa9941a40638e00f85 (diff)
doc: enable snippets translate tool
Create snippets directories in case they don't exist. Add "-q" option as the examples directory to keep the "--quiet" option from the build. Something to consider with this patch: Removing all the previous old snippets, which include not only 'cpp' files, but also '.h', '.qdoc', '.qrc', '.png', and '.qml', which might be used in the snippets, but will need to be updated in the generation tool, to not translate, and copy them over. Change-Id: Icbef9e1c93a12b90dbcfa990ef055ca6f8868407 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 9a4fb2eb72040aeadf6124ec1cad083859ac0787) Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/doc/codesnippets/examples/mainwindows')
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.h113
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py357
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/dockwidgets/mainwindow.py253
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/mainwindow.py366
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py361
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/menus/mainwindow.py366
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/sdi/mainwindow.cpp60
7 files changed, 0 insertions, 1876 deletions
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.h b/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.h
deleted file mode 100644
index ce3eafb89..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-from PySide6.QtGui import QAction
-from PySide6.QtWidgets import (QApplication, QMainWindow, QMenu,
- QPlainTextEdit, QSessionManager)
-
-
-//! [0]
-class MainWindow(QMainWindow):
- def __init__(self, parent=None):
- self.textEdit = QPlainTextEdit()
- self.curFile = ""
- # ...
-
- def loadFile(self, fileName):
- pass
-
- def closeEvent(self, event):
- pass
-
- def newFile(self):
- pass
-
- def open(self):
- pass
-
- def save(self):
- pass
-
- def saveAs(self):
- pass
-
- def about(self):
- pass
-
- def documentWasModified(self):
- pass
- # Enable this only if QT_NO_SESSIONMANAGER is not defined
- # def commitData(self):
- # pass
-
- def createActions(self):
- pass
-
- def createStatusBar(self):
- pass
-
- def readSettings(self):
- pass
-
- def writeSettings(self):
- pass
-
- def maybeSave(self):
- pass
-
- def saveFile(self, fileName):
- pass
-
- def setCurrentFile(self, fileName):
- pass
-
- def strippedName(self, fullFileName):
- pass
-//! [0]
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py
deleted file mode 100644
index fb58f05a8..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py
+++ /dev/null
@@ -1,357 +0,0 @@
-############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the examples of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## BSD License Usage
-## Alternatively, you may use this file under the terms of the BSD license
-## as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-############################################################################
-
-//! [0]
-from PySide6.QtCore import Qt, QFile, QFileInfo, QSettings, QTextStream
-from PySide6.QtGui import QIcon
-from PySide6.Widgets import (QAction, QApplication, QFileDialog, QMainWindow,
- QPlainTextEdit, QFileDialog, QMessageBox, )
-//! [0]
-
-//! [1]
-def __init__(self, parent=None):
- QMainWindow.__init__(self)
-//! [1] //! [2]
- self.textEdit = QPlainTextEdit()
- self.setCentralWidget(textEdit)
-
- self.createActions()
- self.createMenus()
- self.createToolBars()
- self.createStatusBar()
-
- self.readSettings()
-
- self.textEdit.document().contentsChanged.connect(self.documentWasModified)
-
- self.setCurrentFile("")
- self.setUnifiedTitleAndToolBarOnMac(True)
-
-//! [2]
-
-//! [3]
-def closeEvent(self, event):
-//! [3] //! [4]
- if maybeSave():
- writeSettings()
- event.accept()
- else:
- event.ignore()
-//! [4]
-
-//! [5]
-def File(self):
-//! [5] //! [6]
- if maybeSave():
- textEdit.clear()
- setCurrentFile("")
-//! [6]
-
-//! [7]
-def open(self):
-//! [7] //! [8]
- if maybeSave():
- fileName = QFileDialog.getOpenFileName(self)
- if not fileName.isEmpty():
- loadFile(fileName)
-//! [8]
-
-//! [9]
-def save(self):
-//! [9] //! [10]
- if curFile.isEmpty():
- return saveAs()
- else:
- return saveFile(curFile)
-//! [10]
-
-//! [11]
-def saveAs(self):
-//! [11] //! [12]
- fileName = QFileDialog.getSaveFileName(self)
- if fileName.isEmpty():
- return False
-
- return saveFile(fileName)
-//! [12]
-
-//! [13]
-def about(self):
-//! [13] //! [14]
- QMessageBox.about(self, tr("About Application"),
- tr("The <b>Application</b> example demonstrates how to "
- "write modern GUI applications using Qt, with a menu bar, "
- "toolbars, and a status bar."))
-
-//! [14]
-
-//! [15]
-def documentWasModified(self):
-//! [15] //! [16]
- setWindowModified(textEdit.document().isModified())
-//! [16]
-
-//! [17]
-def MainWindow.createActions(self):
-//! [17] //! [18]
- Act = QAction(QIcon(":/images/new.png"), tr("&New"), self)
- Act.setShortcuts(QKeySequence.New)
- Act.setStatusTip(tr("Create a new file"))
- Act.triggered.connect(newFile)
-
-//! [19]
- openAct = QAction(QIcon(":/images/open.png"), tr("&Open..."), self)
- openAct.setShortcuts(QKeySequence.Open)
- openAct.setStatusTip(tr("Open an existing file"))
- openAct.triggered.connect(open)
-//! [18] //! [19]
-
- saveAct = QAction(QIcon(":/images/save.png"), tr("&Save"), self)
- saveAct.setShortcuts(QKeySequence.Save)
- saveAct.setStatusTip(tr("Save the document to disk"))
- saveAct.triggered.connect(save)
-
- saveAsAct = QAction(tr("Save &As..."), self)
- saveAsAct.setShortcuts(QKeySequence.SaveAs)
- saveAsAct.setStatusTip(tr("Save the document under a name"))
- saveAsAct.triggered.connect(saveAs)
-
-//! [20]
- exitAct = QAction(tr("E&xit"), self)
- exitAct.setShortcut(tr("Ctrl+Q"))
-//! [20]
- exitAct.setStatusTip(tr("Exit the application"))
- exitAct.triggered.connect(close)
-
-//! [21]
- cutAct = QAction(QIcon(":/images/cut.png"), tr("Cu&t"), self)
-//! [21]
- cutAct.setShortcuts(QKeySequence.Cut)
- cutAct.setStatusTip(tr("Cut the current selection's contents to the "
- "clipboard"))
- cutAct.triggered.connect(cut)
-
- copyAct = QAction(QIcon(":/images/copy.png"), tr("&Copy"), self)
- copyAct.setShortcuts(QKeySequence.Copy)
- copyAct.setStatusTip(tr("Copy the current selection's contents to the "
- "clipboard"))
- copyAct.triggered.connect(copy)
-
- pasteAct = QAction(QIcon(":/images/paste.png"), tr("&Paste"), self)
- pasteAct.setShortcuts(QKeySequence.Paste)
- pasteAct.setStatusTip(tr("Paste the clipboard's contents into the current "
- "selection"))
- pasteAct.triggered.connect(textEdit.paste)
-
- aboutAct = QAction(tr("&About"), self)
- aboutAct.setStatusTip(tr("Show the application's About box"))
- aboutAct.triggered.connect(about)
-
-//! [22]
- aboutQtAct = QAction(tr("About &Qt"), self)
- aboutQtAct.setStatusTip(tr("Show the Qt library's About box"))
- aboutQtAct.triggered.connect(qApp.aboutQt)
-//! [22]
-
-//! [23]
- cutAct.setEnabled(False)
-//! [23] //! [24]
- copyAct.setEnabled(False)
- textEdit.copyAvailable[bool].connect(cutAct.setEnabled)
- textEdit.copyAvailable[bool].connect(copyAct.setEnabled)
-}
-//! [24]
-
-//! [25] //! [26]
-def createMenus(self):
-//! [25] //! [27]
- fileMenu = menuBar().addMenu(tr("&File"))
- fileMenu.addAction(Act)
-//! [28]
- fileMenu.addAction(openAct)
-//! [28]
- fileMenu.addAction(saveAct)
-//! [26]
- fileMenu.addAction(saveAsAct)
- fileMenu.addSeparator()
- fileMenu.addAction(exitAct)
-
- editMenu = menuBar().addMenu(tr("&Edit"))
- editMenu.addAction(cutAct)
- editMenu.addAction(copyAct)
- editMenu.addAction(pasteAct)
-
- menuBar().addSeparator()
-
- helpMenu = menuBar().addMenu(tr("&Help"))
- helpMenu.addAction(aboutAct)
- helpMenu.addAction(aboutQtAct)
-
-//! [27]
-
-//! [29] //! [30]
-def createToolBars(self):
- fileToolBar = addToolBar(tr("File"))
- fileToolBar.addAction(Act)
-//! [29] //! [31]
- fileToolBar.addAction(openAct)
-//! [31]
- fileToolBar.addAction(saveAct)
-
- editToolBar = addToolBar(tr("Edit"))
- editToolBar.addAction(cutAct)
- editToolBar.addAction(copyAct)
- editToolBar.addAction(pasteAct)
-//! [30]
-
-//! [32]
-def createStatusBar(self):
-//! [32] //! [33]
- statusBar().showMessage(tr("Ready"))
-
-//! [33]
-
-//! [34] //! [35]
-def readSettings(self):
-//! [34] //! [36]
- settings("Trolltech", "Application Example")
- pos = settings.value("pos", QPoint(200, 200)).toPoint()
- size = settings.value("size", QSize(400, 400)).toSize()
- resize(size)
- move(pos)
-
-//! [35] //! [36]
-
-//! [37] //! [38]
-def writeSettings(self):
-//! [37] //! [39]
- settings = QSettings("Trolltech", "Application Example")
- settings.setValue("pos", pos())
- settings.setValue("size", size())
-
-//! [38] //! [39]
-
-//! [40]
-def maybeSave(self):
-//! [40] //! [41]
- if textEdit.document().isModified():
- ret = QMessageBox.warning(self, tr("Application"),
- tr("The document has been modified.\n"
- "Do you want to save your changes?"),
- QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
- if ret == QMessageBox.Save:
- return save()
- elif ret == QMessageBox.Cancel:
- return False
- return True
-//! [41]
-
-//! [42]
-def loadFile(self, fileName):
-//! [42] //! [43]
- file = QFile(fileName)
- if !file.open(QFile.ReadOnly | QFile.Text):
- QMessageBox.warning(self, tr("Application"), tr("Cannot read file "
- f"{fileName}:\n{file.errorString()}."))
- return
-
- in = QTextStream(file)
- QApplication.setOverrideCursor(Qt::WaitCursor)
- textEdit.setPlainText(in.readAll())
- QApplication.restoreOverrideCursor()
-
- self.setCurrentFile(fileName)
- self.statusBar().showMessage(tr("File loaded"), 2000)
-
-//! [43]
-
-//! [44]
-def saveFile(self, fileName):
-//! [44] //! [45]
- file = QFile(fileName)
- if !file.open(QFile.WriteOnly | QFile::Text):
- QMessageBox.warning(self, tr("Application"),
- tr("Cannot write file %1:\n%2.")
- .arg(fileName)
- .arg(file.errorString()))
- return False
-
- out = QTextStream(file)
- QApplication.setOverrideCursor(Qt.WaitCursor)
- out << textEdit.toPlainText()
- QApplication.restoreOverrideCursor()
-
- setCurrentFile(fileName)
- statusBar().showMessage(tr("File saved"), 2000)
- return True
-
-//! [45]
-
-//! [46]
-def setCurrentFile(fileName):
-//! [46] //! [47]
- curFile = fileName
- textEdit.document().setModified(False)
- setWindowModified(False)
-
- if curFile.isEmpty():
- shownName = "untitled.txt"
- else:
- shownName = strippedName(curFile)
-
- setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Application")))
-
-//! [47]
-
-//! [48]
-def strippedName(self, fullFileName):
-//! [48] //! [49]
- return QFileInfo(fullFileName).fileName()
-//! [49]
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/dockwidgets/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/dockwidgets/mainwindow.py
deleted file mode 100644
index b8ff9d5bc..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/dockwidgets/mainwindow.py
+++ /dev/null
@@ -1,253 +0,0 @@
-############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the examples of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## BSD License Usage
-## Alternatively, you may use this file under the terms of the BSD license
-## as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-############################################################################
-
-//! [0]
-from PySide6.QtGui import *
-//! [0]
-
-//! [1]
-def __init__(self):
- textEdit = QTextEdit()
- setCentralWidget(textEdit)
-
- createActions()
- createMenus()
- createToolBars()
- createStatusBar()
- createDockWindows()
-
- setWindowTitle(tr("Dock Widgets"))
-
- Letter()
- setUnifiedTitleAndToolBarOnMac(True)
-//! [1]
-
-//! [2]
-def Letter(self)
- textEdit.clear()
-
- cursor = QTextCursor(textEdit.textCursor())
- cursor.movePosition(QTextCursor.Start)
- topFrame = cursor.currentFrame()
- topFrameFormat = topFrame.frameFormat()
- topFrameFormat.setPadding(16)
- topFrame.setFrameFormat(topFrameFormat)
-
- textFormat = QTextCharFormat()
- boldFormat = QTextCharFormat()
- boldFormat.setFontWeight(QFont.Bold)
- italicFormat = QTextCharFormat()
- italicFormat.setFontItalic(True)
-
- tableFormat = QTextTableFormat()
- tableFormat.setBorder(1)
- tableFormat.setCellPadding(16)
- tableFormat.setAlignment(Qt.AlignRight)
- cursor.insertTable(1, 1, tableFormat)
- cursor.insertText("The Firm", boldFormat)
- cursor.insertBlock()
- cursor.insertText("321 City Street", textFormat)
- cursor.insertBlock()
- cursor.insertText("Industry Park")
- cursor.insertBlock()
- cursor.insertText("Some Country")
- cursor.setPosition(topFrame.lastPosition())
- cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"), textFormat)
- cursor.insertBlock()
- cursor.insertBlock()
- cursor.insertText("Dear ", textFormat)
- cursor.insertText("NAME", italicFormat)
- cursor.insertText(",", textFormat)
- for i in range(3):
- cursor.insertBlock()
- cursor.insertText(tr("Yours sincerely,"), textFormat)
- for i in range(3):
- cursor.insertBlock()
- cursor.insertText("The Boss", textFormat)
- cursor.insertBlock()
- cursor.insertText("ADDRESS", italicFormat)
-//! [2]
-
-//! [3]
-def print(self)
- document = textEdit.document()
- printer = QPrinter()
-
- dlg = QPrintDialog(&printer, self)
- if dlg.exec() != QDialog.Accepted:
- return
-
- document.print(printer)
- statusBar().showMessage(tr("Ready"), 2000)
-//! [3]
-
-//! [4]
-def save(self):
- fileName = QFileDialog.getSaveFileName(self,
- tr("Choose a file name"), ".",
- tr("HTML (*.html *.htm)"))
- if fileName.isEmpty():
- return
- file = QFile(fileName)
- if !file.open(QFile.WriteOnly | QFile::Text):
- QMessageBox.warning(self, tr("Dock Widgets"),
- tr("Cannot write file %1:\n%2.")
- .arg(fileName)
- .arg(file.errorString()))
- return
-
-
- out = QTextStream(file)
- QApplication.setOverrideCursor(Qt::WaitCursor)
- out << textEdit.toHtml()
- QApplication.restoreOverrideCursor()
-
- statusBar().showMessage(tr("Saved '%1'").arg(fileName), 2000)
-
-//! [4]
-
-//! [5]
-def undo(self):
- document = textEdit.document()
- document.undo()
-
-//! [5]
-
-//! [6]
-def insertCustomer(self, customer):
- if customer.isEmpty():
- return
-
- customerList = customer.split(", ")
- document = textEdit.document()
- cursor = document.find("NAME")
- if not cursor.isNull():
- cursor.beginEditBlock()
- cursor.insertText(customerList.at(0))
- oldcursor = cursor
- cursor = document.find("ADDRESS")
- if not cursor.isNull():
- for i in range(customerList.size()):
- cursor.insertBlock()
- cursor.insertText(customerList.at(i))
-
- cursor.endEditBlock()
- else:
- oldcursor.endEditBlock()
-//! [6]
-
-//! [7]
-def addParagraph(self, paragraph):
- if (paragraph.isEmpty())
- return
-
- document = textEdit.document()
- cursor = document.find(tr("Yours sincerely,"))
- if cursor.isNull():
- return
- cursor.beginEditBlock()
- cursor.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor, 2)
- cursor.insertBlock()
- cursor.insertText(paragraph)
- cursor.insertBlock()
- cursor.endEditBlock()
-
-//! [7]
-
-
-//! [8]
-def createStatusBar(self):
- statusBar().showMessage(tr("Ready"))
-
-//! [8]
-
-//! [9]
-def createDockWindows(self):
- dock = QDockWidget(tr("Customers"), self)
- dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
- customerList = QListWidget(dock)
- customerList.addItems(QStringList()
- << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
- << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
- << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
- << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
- << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
- << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula")
- dock.setWidget(customerList)
- addDockWidget(Qt.RightDockWidgetArea, dock)
- viewMenu.addAction(dock.toggleViewAction())
-
- dock = QDockWidget(tr("Paragraphs"), self)
- paragraphsList = QListWidget(dock)
- paragraphsList.addItems(QStringList()
- << "Thank you for your payment which we have received today."
- << "Your order has been dispatched and should be with you "
- "within 28 days."
- << "We have dispatched those items that were in stock. The "
- "rest of your order will be dispatched once all the "
- "remaining items have arrived at our warehouse. No "
- "additional shipping charges will be made."
- << "You made a small overpayment (less than $5) which we "
- "will keep on account for you, or return at your request."
- << "You made a small underpayment (less than $1), but we have "
- "sent your order anyway. We'll add self underpayment to "
- "your next bill."
- << "Unfortunately you did not send enough money. Please remit "
- "an additional $. Your order will be dispatched as soon as "
- "the complete amount has been received."
- << "You made an overpayment (more than $5). Do you wish to "
- "buy more items, or should we return the excess to you?")
- dock.setWidget(paragraphsList)
- addDockWidget(Qt.RightDockWidgetArea, dock)
- viewMenu.addAction(dock.toggleViewAction())
-
- customerList.currentTextChanged[str].connect(self.insertCostumer)
- paragraphsList.currentTextChanged[str].connect(self.addParagraph)
-//! [9]
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/mainwindow.py
deleted file mode 100644
index d39604b6c..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/mainwindow.py
+++ /dev/null
@@ -1,366 +0,0 @@
-############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the examples of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## BSD License Usage
-## Alternatively, you may use this file under the terms of the BSD license
-## as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-############################################################################
-
-from PySide6.QtGui import *
-
-//! [0]
-def __init__(self):
- Q__init__(self)
-
- widget = QWidget()
- setCentralWidget(widget)
-//! [0]
-
-//! [1]
- topFiller = QWidget()
- topFiller.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-
- infoLabel = QLabel(tr("<i>Choose a menu option, or right-click to "
- "invoke a context menu</i>"))
- infoLabel.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
- infoLabel.setAlignment(Qt.AlignCenter)
-
- bottomFiller = QWidget()
- bottomFiller.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-
- layout = QVBoxLayout()
- layout.setMargin(5)
- layout.addWidget(topFiller)
- layout.addWidget(infoLabel)
- layout.addWidget(bottomFiller)
- widget.setLayout(layout)
-//! [1]
-
-//! [2]
- createActions()
- createMenus()
-
- message = tr("A context menu is available by right-clicking")
- statusBar().showMessage(message)
-
- setWindowTitle(tr("Menus"))
- setMinimumSize(160, 160)
- resize(480, 320)
-
-//! [2]
-
-//! [3]
-def contextMenuEvent(self, event):
- menu = QMenu(self)
- menu.addAction(cutAct)
- menu.addAction(copyAct)
- menu.addAction(pasteAct)
- menu.exec_(event.globalPos()")
-
-//! [3]
-
-def File(self):
- infoLabel.setText(tr("Invoked <b>File|New</b>"))
-
-
-def open(self):
- infoLabel.setText(tr("Invoked <b>File|Open</b>"))
-
-
-def save(self):
- infoLabel.setText(tr("Invoked <b>File|Save</b>"))
-
-def print_(self):
- infoLabel.setText(tr("Invoked <b>File|Print</b>"))
-
-def undo(self):
- infoLabel.setText(tr("Invoked <b>Edit|Undo</b>"))
-
-def redo(self):
- infoLabel.setText(tr("Invoked <b>Edit|Redo</b>"))
-
-def cut(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Cut</b>"))
-
-
-def copy(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Copy</b>"))
-
-
-def paste(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Paste</b>"))
-
-
-def bold(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Bold</b>"))
-
-
-def italic(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Italic</b>"))
-
-
-def leftAlign(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Left Align</b>"))
-
-
-def rightAlign(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Right Align</b>"))
-
-
-def justify(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Justify</b>"))
-
-
-def center(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Center</b>"))
-
-
-def setLineSpacing(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Set Line Spacing</b>"))
-
-
-def setParagraphSpacing(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Set Paragraph Spacing</b>"))
-
-
-def about(self):
-
- infoLabel.setText(tr("Invoked <b>Help|About</b>"))
- QMessageBox.about(self, tr("About Menu"),
- tr("The <b>Menu</b> example shows how to create "
- "menu-bar menus and context menus."))
-
-
-def aboutQt(self):
-
- infoLabel.setText(tr("Invoked <b>Help|About Qt</b>"))
-
-
-//! [4]
-def createActions(self):
-
-//! [5]
- Act = new QAction(tr("&New"), self)
- Act.setShortcuts(QKeySequence.New)
- Act.setStatusTip(tr("Create a new file"))
- Act.triggered.connect(newFile)
-//! [4]
-
- openAct = QAction(tr("&Open..."), self)
- openAct.setShortcuts(QKeySequence.Open)
- openAct.setStatusTip(tr("Open an existing file"))
- openAct.triggered.connect(open)
-//! [5]
-
- saveAct = QAction(tr("&Save"), self)
- saveAct.setShortcuts(QKeySequence.Save)
- saveAct.setStatusTip(tr("Save the document to disk"))
- saveAct.triggered.connect(save)
-
- printAct = QAction(tr("&Print..."), self)
- printAct.setShortcuts(QKeySequence.Print)
- printAct.setStatusTip(tr("Print the document"))
- printAct.triggered.connect(print_)
-
- exitAct = QAction(tr("E&xit"), self)
- exitAct.setShortcut(tr("Ctrl+Q"))
- exitAct.setStatusTip(tr("Exit the application"))
- exitAct.triggered.connect(close)
-
- undoAct = QAction(tr("&Undo"), self)
- undoAct.setShortcuts(QKeySequence.Undo)
- undoAct.setStatusTip(tr("Undo the last operation"))
- undoAct.triggered.connect(undo)
-
- redoAct = QAction(tr("&Redo"), self)
- redoAct.setShortcuts(QKeySequence.Redo)
- redoAct.setStatusTip(tr("Redo the last operation"))
- redoAct.triggered.connect(redo)
-
- cutAct = QAction(tr("Cu&t"), self)
- cutAct.setShortcuts(QKeySequence.Cut)
- cutAct.setStatusTip(tr("Cut the current selection's contents to the "
- "clipboard"))
- cutAct.triggered.connect(cut)
-
- copyAct = QAction(tr("&Copy"), self)
- copyAct.setShortcut(tr("Ctrl+C"))
- copyAct.setStatusTip(tr("Copy the current selection's contents to the "
- "clipboard"))
- copyAct.triggered.connect(copy)
-
- pasteAct = QAction(tr("&Paste"), self)
- pasteAct.setShortcuts(QKeySequence.Paste)
- pasteAct.setStatusTip(tr("Paste the clipboard's contents into the current "
- "selection"))
- pasteAct.triggered.connect(paste)
-
- boldAct = QAction(tr("&Bold"), self)
- boldAct.setCheckable(True)
- boldAct.setShortcut(tr("Ctrl+B"))
- boldAct.setStatusTip(tr("Make the text bold"))
- boldAct.triggered.connect(bold)
-
- QFont boldFont = boldAct.font()
- boldFont.setBold(True)
- boldAct.setFont(boldFont)
-
- italicAct = QAction(tr("&Italic"), self)
- italicAct.setCheckable(True)
- italicAct.setShortcut(tr("Ctrl+I"))
- italicAct.setStatusTip(tr("Make the text italic"))
- italicAct.triggered.connect(italic)
-
- QFont italicFont = italicAct.font()
- italicFont.setItalic(True)
- italicAct.setFont(italicFont)
-
- setLineSpacingAct = QAction(tr("Set &Line Spacing..."), self)
- setLineSpacingAct.setStatusTip(tr("Change the gap between the lines of a "
- "paragraph"))
- setLineSpacingAct.triggered.connect(setLineSpacing)
-
- setParagraphSpacingAct = QAction(tr("Set &Paragraph Spacing..."), self)
- setLineSpacingAct.setStatusTip(tr("Change the gap between paragraphs"))
- setParagraphSpacingAct.triggered.connect(setParagraphSpacing)
-
- aboutAct = QAction(tr("&About"), self)
- aboutAct.setStatusTip(tr("Show the application's About box"))
- aboutAct.triggered.connect(about)
-
- aboutQtAct = QAction(tr("About &Qt"), self)
- aboutQtAct.setStatusTip(tr("Show the Qt library's About box"))
- aboutQtAct.triggered.connect(qApp.aboutQt)
- aboutQtAct.triggered.connect(aboutQt)
-
- leftAlignAct = QAction(tr("&Left Align"), self)
- leftAlignAct.setCheckable(True)
- leftAlignAct.setShortcut(tr("Ctrl+L"))
- leftAlignAct.setStatusTip(tr("Left align the selected text"))
- leftAlignAct.triggered.connect(leftAlign)
-
- rightAlignAct = QAction(tr("&Right Align"), self)
- rightAlignAct.setCheckable(True)
- rightAlignAct.setShortcut(tr("Ctrl+R"))
- rightAlignAct.setStatusTip(tr("Right align the selected text"))
- rightAlignAct.triggered.connect.(rightAlign)
-
- justifyAct = QAction(tr("&Justify"), self)
- justifyAct.setCheckable(True)
- justifyAct.setShortcut(tr("Ctrl+J"))
- justifyAct.setStatusTip(tr("Justify the selected text"))
- justifyAct.triggered.connect(justify)
-
- centerAct = QAction(tr("&Center"), self)
- centerAct.setCheckable(True)
- centerAct.setShortcut(tr("Ctrl+E"))
- centerAct.setStatusTip(tr("Center the selected text"))
- centerAct.triggered.connect(center)
-
-//! [6] //! [7]
- alignmentGroup = QActionGroup(self)
- alignmentGroup.addAction(leftAlignAct)
- alignmentGroup.addAction(rightAlignAct)
- alignmentGroup.addAction(justifyAct)
- alignmentGroup.addAction(centerAct)
- leftAlignAct.setChecked(True)
-//! [6]
-
-//! [7]
-
-//! [8]
-def createMenus(self):
-
-//! [9] //! [10]
- fileMenu = menuBar().addMenu(tr("&File"))
- fileMenu.addAction(Act)
-//! [9]
- fileMenu.addAction(openAct)
-//! [10]
- fileMenu.addAction(saveAct)
- fileMenu.addAction(printAct)
-//! [11]
- fileMenu.addSeparator()
-//! [11]
- fileMenu.addAction(exitAct)
-
- editMenu = menuBar().addMenu(tr("&Edit"))
- editMenu.addAction(undoAct)
- editMenu.addAction(redoAct)
- editMenu.addSeparator()
- editMenu.addAction(cutAct)
- editMenu.addAction(copyAct)
- editMenu.addAction(pasteAct)
- editMenu.addSeparator()
-
- helpMenu = menuBar().addMenu(tr("&Help"))
- helpMenu.addAction(aboutAct)
- helpMenu.addAction(aboutQtAct)
-//! [8]
-
-//! [12]
- formatMenu = editMenu.addMenu(tr("&Format"))
- formatMenu.addAction(boldAct)
- formatMenu.addAction(italicAct)
- formatMenu.addSeparator()->setText(tr("Alignment"))
- formatMenu.addAction(leftAlignAct)
- formatMenu.addAction(rightAlignAct)
- formatMenu.addAction(justifyAct)
- formatMenu.addAction(centerAct)
- formatMenu.addSeparator()
- formatMenu.addAction(setLineSpacingAct)
- formatMenu.addAction(setParagraphSpacingAct)
-//! [12]
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py
deleted file mode 100644
index 984210189..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py
+++ /dev/null
@@ -1,361 +0,0 @@
-############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the examples of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## BSD License Usage
-## Alternatively, you may use this file under the terms of the BSD license
-## as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-############################################################################
-
-from PySide6.QtGui import *
-
-class QMdiSubWindow(QMainWindow):
- def __init__(self, parent=None):
- QMainWindow.__init__(self, parent)
-
- mdiArea = QMdiArea()
- mdiArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
- mdiArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
- setCentralWidget(mdiArea)
- mdiArea.subWindowActivated[QMdiSubWindow].connect(updateMenus)
- windowMapper = QSignalMapper(self)
- windowMapper.mapped[QWidget].connect(setActiveSubWindow)
-
- self.createActions()
- self.createMenus()
- self.createToolBars()
- self.createStatusBar()
- self.updateMenus()
- self.readSettings()
- self.setWindowTitle(tr("MDI"))
- self.setUnifiedTitleAndToolBarOnMac(True)
-
-
- def closeEvent(self, event):
- mdiArea.closeAllSubWindows()
- if self.activeMdiChild():
- event.ignore()
- else:
- self.writeSettings()
- event.accept()
-
- def File(self):
- child = self.createMdiChild()
- child.File()
- child.show()
-
-
- def open(self):
- fileName = QFileDialog.getOpenFileName(self)
- if not fileName.isEmpty():
- existing = self.findMdiChild(fileName)
- if existing:
- mdiArea.setActiveSubWindow(existing)
- return
-
- child = createMdiChild()
- if child.loadFile(fileName):
- statusBar().showMessage(tr("File loaded"), 2000)
- child.show()
- else:
- child.close()
-
- def save(self):
- if self.activeMdiChild() and self.activeMdiChild().save():
- self.statusBar().showMessage(tr("File saved"), 2000)
-
- def saveAs(self):
- if self.activeMdiChild() and self.activeMdiChild().saveAs():
- self.statusBar().showMessage(tr("File saved"), 2000)
-
- def cut(self):
- if self.activeMdiChild():
- self.activeMdiChild().cut()
-
- def copy(self):
- if self.activeMdiChild():
- activeMdiChild().copy()
-
- def paste(self):
- if self.activeMdiChild():
- activeMdiChild().paste()
-
- def about(self):
- QMessageBox.about(self, tr("About MDI"),
- tr("The <b>MDI</b> example demonstrates how to write multiple "
- "document interface applications using Qt."))
-
- def updateMenus(self):
- hasMdiChild = (activeMdiChild() != 0)
- self.saveAct.setEnabled(hasMdiChild)
- self.saveAsAct.setEnabled(hasMdiChild)
- self.pasteAct.setEnabled(hasMdiChild)
- self.closeAct.setEnabled(hasMdiChild)
- self.closeAllAct.setEnabled(hasMdiChild)
- self.tileAct.setEnabled(hasMdiChild)
- self.cascadeAct.setEnabled(hasMdiChild)
- self.nextAct.setEnabled(hasMdiChild)
- self.previousAct.setEnabled(hasMdiChild)
- self.separatorAct.setVisible(hasMdiChild)
-
- hasSelection = (self.activeMdiChild() and
- self.activeMdiChild().textCursor().hasSelection())
- self.cutAct.setEnabled(hasSelection)
- self.copyAct.setEnabled(hasSelection)
-
- def updateWindowMenu(self):
- self.windowMenu.clear()
- self.windowMenu.addAction(closeAct)
- self.windowMenu.addAction(closeAllAct)
- self.windowMenu.addSeparator()
- self.windowMenu.addAction(tileAct)
- self.windowMenu.addAction(cascadeAct)
- self.windowMenu.addSeparator()
- self.windowMenu.addAction(nextAct)
- self.windowMenu.addAction(previousAct)
- self.windowMenu.addAction(separatorAct)
-
- windows = mdiArea.subWindowList()
- separatorAct.setVisible(not windows.isEmpty())
-
- for i in range(0, windows.size()):
- child = windows.at(i).widget()
-
- text = ""
- child_file = child.userFriendlyCurrentFile()
- if i < 9:
- text = f"&{i + 1} {child_file}"
- else:
- text = f"{i + 1} {child_file}"
-
- action = windowMenu.addAction(text)
- action.setCheckable(True)
- action.setChecked(child == activeMdiChild())
- action.triggered.connect(windowMapper.map)
- windowMapper.setMapping(action, windows.at(i))
-
- createMdiChild = MdiChild()
-
- child = MdiChild()
- mdiArea.addSubWindow(child)
-
- child.copyAvailable[bool].connect(cutAct.setEnabled)
- child.copyAvailable[bool].connect(copyAct.setEnabled)
-
- return child
-
-
- def createActions(self):
-
- Act = QAction(QIcon(":/images/new.png"), tr("&New"), self)
- Act.setShortcuts(QKeySequence.New)
- Act.setStatusTip(tr("Create a new file"))
- Act.triggered.connect(self.newFile)
-
- openAct = QAction(QIcon(":/images/open.png"), tr("&Open..."), self)
- openAct.setShortcuts(QKeySequence.Open)
- openAct.setStatusTip(tr("Open an existing file"))
- openAct.triggered.connect(self.open)
-
- saveAct = QAction(QIcon(":/images/save.png"), tr("&Save"), self)
- saveAct.setShortcuts(QKeySequence.Save)
- saveAct.setStatusTip(tr("Save the document to disk"))
- saveAct.triggered.connect(self.save)
-
- saveAsAct = QAction(tr("Save &As..."), self)
- saveAsAct.setShortcuts(QKeySequence.SaveAs)
- saveAsAct.setStatusTip(tr("Save the document under a name"))
- saveAsAct.triggered.connect(self.saveAs)
-
-//! [0]
- exitAct = QAction(tr("E&xit"), self)
- exitAct.setShortcut(tr("Ctrl+Q"))
- exitAct.setStatusTip(tr("Exit the application"))
- exitAct.triggered.connect(qApp.closeAllWindows)
-//! [0]
-
- cutAct = QAction(QIcon(":/images/cut.png"), tr("Cu&t"), self)
- cutAct.setShortcuts(QKeySequence.Cut)
- cutAct.setStatusTip(tr("Cut the current selection's contents to the "
- "clipboard"))
- cutAct.triggered.connect(self.cut)
-
- copyAct = QAction(QIcon(":/images/copy.png"), tr("&Copy"), self)
- copyAct.setShortcuts(QKeySequence.Copy)
- copyAct.setStatusTip(tr("Copy the current selection's contents to the "
- "clipboard"))
- copyAct.triggered.connect(self.copy)
-
- pasteAct = QAction(QIcon(":/images/paste.png"), tr("&Paste"), self)
- pasteAct.setShortcuts(QKeySequence.Paste)
- pasteAct.setStatusTip(tr("Paste the clipboard's contents into the current "
- "selection"))
- pasteAct.triggered.connect(self.paste)
-
- closeAct = QAction(tr("Cl&ose"), self)
- closeAct.setShortcut(tr("Ctrl+F4"))
- closeAct.setStatusTip(tr("Close the active window"))
- closeAct.triggered.connect(mdiArea.closeActiveSubWindow)
-
- closeAllAct = QAction(tr("Close &All"), self)
- closeAllAct.setStatusTip(tr("Close all the windows"))
- closeAllAct.triggered.connect(mdiArea.closeAllSubWindows)
-
- tileAct = QAction(tr("&Tile"), self)
- tileAct.setStatusTip(tr("Tile the windows"))
- tileAct.triggered.connect(mdiArea.tileSubWindows)
-
- cascadeAct = QAction(tr("&Cascade"), self)
- cascadeAct.setStatusTip(tr("Cascade the windows"))
- cascadeAct.triggered.connect(mdiArea.cascadeSubWindows)
-
- nextAct = QAction(tr("Ne&xt"), self)
- nextAct.setShortcuts(QKeySequence.NextChild)
- nextAct.setStatusTip(tr("Move the focus to the next window"))
- nextAct.triggered.connect(mdiArea.activateNextSubWindow)
-
- previousAct = QAction(tr("Pre&vious"), self)
- previousAct.setShortcuts(QKeySequence.PreviousChild)
- previousAct.setStatusTip(tr("Move the focus to the previous "
- "window"))
- previousAct.triggered.connect(mdiArea.activatePreviousSubWindow)
-
- separatorAct = QAction(self)
- separatorAct.setSeparator(True)
-
- aboutAct = QAction(tr("&About"), self)
- aboutAct.setStatusTip(tr("Show the application's About box"))
- aboutAct.triggered.connect(self.about)
-
- aboutQtAct = QAction(tr("About &Qt"), self)
- aboutQtAct.setStatusTip(tr("Show the Qt library's About box"))
- aboutQtAct.triggered.connect(qApp.aboutQt)
-
-
- def createMenus(self):
-
- fileMenu = menuBar().addMenu(tr("&File"))
- fileMenu.addAction(Act)
- fileMenu.addAction(openAct)
- fileMenu.addAction(saveAct)
- fileMenu.addAction(saveAsAct)
- fileMenu.addSeparator()
- action = fileMenu.addAction(tr("Switch layout direction"))
- action.triggered.connect(self.switchLayoutDirection)
- fileMenu.addAction(exitAct)
-
- editMenu = menuBar().addMenu(tr("&Edit"))
- editMenu.addAction(cutAct)
- editMenu.addAction(copyAct)
- editMenu.addAction(pasteAct)
-
- windowMenu = menuBar().addMenu(tr("&Window"))
- updateWindowMenu()
- windowMenu.aboutToShow.connect(self.updateWindowMenu)
-
- menuBar().addSeparator()
-
- helpMenu = menuBar().addMenu(tr("&Help"))
- helpMenu.addAction(aboutAct)
- helpMenu.addAction(aboutQtAct)
-
-
- def createToolBars(self):
- fileToolBar = addToolBar(tr("File"))
- fileToolBar.addAction(Act)
- fileToolBar.addAction(openAct)
- fileToolBar.addAction(saveAct)
-
- editToolBar = addToolBar(tr("Edit"))
- editToolBar.addAction(cutAct)
- editToolBar.addAction(copyAct)
- editToolBar.addAction(pasteAct)
-
-
- def createStatusBar(self):
- statusBar().showMessage(tr("Ready"))
-
-
- def readSettings(self):
- settings = QSettings("Trolltech", "MDI Example")
- QPoint pos = settings.value("pos", QPoint(200, 200)").toPoint()
- QSize size = settings.value("size", QSize(400, 400)").toSize()
- move(pos)
- resize(size)
-
- def writeSettings(self):
- QSettings settings("Trolltech", "MDI Example")
- settings.setValue("pos", pos()")
- settings.setValue("size", size()")
-
-
- activeMdiChild = MdiChild()
- activeSubWindow = mdiArea.activeSubWindow()
- if activeSubWindow:
- return activeSubWindow.widget()
- return 0
-
-
- def findMdiChild(self, fileName):
-
- canonicalFilePath = QFileInfo(fileName).canonicalFilePath()
-
- for window in mdiArea.subWindowList():
- mdiChild = window.widget()
- if mdiChild.currentFile() == canonicalFilePath:
- return window
- return 0
-
-
- def switchLayoutDirection(self)
- if layoutDirection() == Qt.LeftToRight:
- qApp.setLayoutDirection(Qt.RightToLeft)
- else:
- qApp.setLayoutDirection(Qt.LeftToRight)
-
-
- def setActiveSubWindow(self, window):
- if not window:
- return
- mdiArea.setActiveSubWindow(window)
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/menus/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/menus/mainwindow.py
deleted file mode 100644
index 71586723e..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/menus/mainwindow.py
+++ /dev/null
@@ -1,366 +0,0 @@
-############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the examples of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## BSD License Usage
-## Alternatively, you may use this file under the terms of the BSD license
-## as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-############################################################################
-
-from PySide6.QtGui import *
-
-//! [0]
-def __init__(self):
- Q__init__(self)
-
- widget = QWidget()
- setCentralWidget(widget)
-//! [0]
-
-//! [1]
- topFiller = QWidget()
- topFiller.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-
- infoLabel = QLabel(tr("<i>Choose a menu option, or right-click to "
- "invoke a context menu</i>"))
- infoLabel.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
- infoLabel.setAlignment(Qt.AlignCenter)
-
- bottomFiller = QWidget()
- bottomFiller.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-
- layout = QVBoxLayout()
- layout.setMargin(5)
- layout.addWidget(topFiller)
- layout.addWidget(infoLabel)
- layout.addWidget(bottomFiller)
- widget.setLayout(layout)
-//! [1]
-
-//! [2]
- createActions()
- createMenus()
-
- message = tr("A context menu is available by right-clicking")
- statusBar().showMessage(message)
-
- setWindowTitle(tr("Menus"))
- setMinimumSize(160, 160)
- resize(480, 320)
-
-//! [2]
-
-//! [3]
-def contextMenuEvent(self, event):
- menu = QMenu(self)
- menu.addAction(cutAct)
- menu.addAction(copyAct)
- menu.addAction(pasteAct)
- menu.exec_(event.globalPos()")
-
-//! [3]
-
-def File(self):
- infoLabel.setText(tr("Invoked <b>File|New</b>"))
-
-
-def open(self):
- infoLabel.setText(tr("Invoked <b>File|Open</b>"))
-
-
-def save(self):
- infoLabel.setText(tr("Invoked <b>File|Save</b>"))
-
-def print_(self):
- infoLabel.setText(tr("Invoked <b>File|Print</b>"))
-
-def undo(self):
- infoLabel.setText(tr("Invoked <b>Edit|Undo</b>"))
-
-def redo(self):
- infoLabel.setText(tr("Invoked <b>Edit|Redo</b>"))
-
-def cut(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Cut</b>"))
-
-
-def copy(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Copy</b>"))
-
-
-def paste(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Paste</b>"))
-
-
-def bold(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Bold</b>"))
-
-
-def italic(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Italic</b>"))
-
-
-def leftAlign(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Left Align</b>"))
-
-
-def rightAlign(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Right Align</b>"))
-
-
-def justify(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Justify</b>"))
-
-
-def center(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Center</b>"))
-
-
-def setLineSpacing(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Set Line Spacing</b>"))
-
-
-def setParagraphSpacing(self):
-
- infoLabel.setText(tr("Invoked <b>Edit|Format|Set Paragraph Spacing</b>"))
-
-
-def about(self):
-
- infoLabel.setText(tr("Invoked <b>Help|About</b>"))
- QMessageBox.about(self, tr("About Menu"),
- tr("The <b>Menu</b> example shows how to create "
- "menu-bar menus and context menus."))
-
-
-def aboutQt(self):
-
- infoLabel.setText(tr("Invoked <b>Help|About Qt</b>"))
-
-
-//! [4]
-def createActions(self):
-
-//! [5]
- Act = new QAction(tr("&New"), self)
- Act.setShortcuts(QKeySequence.New)
- Act.setStatusTip(tr("Create a new file"))
- Act.triggered.connect(newFile)
-//! [4]
-
- openAct = QAction(tr("&Open..."), self)
- openAct.setShortcuts(QKeySequence.Open)
- openAct.setStatusTip(tr("Open an existing file"))
- openAct.triggered.connect(open)
-//! [5]
-
- saveAct = QAction(tr("&Save"), self)
- saveAct.setShortcuts(QKeySequence.Save)
- saveAct.setStatusTip(tr("Save the document to disk"))
- saveAct.triggered.connect(save)
-
- printAct = QAction(tr("&Print..."), self)
- printAct.setShortcuts(QKeySequence.Print)
- printAct.setStatusTip(tr("Print the document"))
- printAct.triggered.connect(print_)
-
- exitAct = QAction(tr("E&xit"), self)
- exitAct.setShortcut(tr("Ctrl+Q"))
- exitAct.setStatusTip(tr("Exit the application"))
- exitAct.triggered.connect(close)
-
- undoAct = QAction(tr("&Undo"), self)
- undoAct.setShortcuts(QKeySequence.Undo)
- undoAct.setStatusTip(tr("Undo the last operation"))
- undoAct.triggered.connect(undo)
-
- redoAct = QAction(tr("&Redo"), self)
- redoAct.setShortcuts(QKeySequence.Redo)
- redoAct.setStatusTip(tr("Redo the last operation"))
- redoAct.triggered.connect(redo)
-
- cutAct = QAction(tr("Cu&t"), self)
- cutAct.setShortcuts(QKeySequence.Cut)
- cutAct.setStatusTip(tr("Cut the current selection's contents to the "
- "clipboard"))
- cutAct.triggered.connect(cut)
-
- copyAct = QAction(tr("&Copy"), self)
- copyAct.setShortcut(tr("Ctrl+C"))
- copyAct.setStatusTip(tr("Copy the current selection's contents to the "
- "clipboard"))
- copyAct.triggered.connect(copy)
-
- pasteAct = QAction(tr("&Paste"), self)
- pasteAct.setShortcuts(QKeySequence.Paste)
- pasteAct.setStatusTip(tr("Paste the clipboard's contents into the current "
- "selection"))
- pasteAct.triggered.connect(paste)
-
- boldAct = QAction(tr("&Bold"), self)
- boldAct.setCheckable(True)
- boldAct.setShortcut(tr("Ctrl+B"))
- boldAct.setStatusTip(tr("Make the text bold"))
- boldAct.triggered.connect(bold)
-
- QFont boldFont = boldAct.font()
- boldFont.setBold(True)
- boldAct.setFont(boldFont)
-
- italicAct = QAction(tr("&Italic"), self)
- italicAct.setCheckable(True)
- italicAct.setShortcut(tr("Ctrl+I"))
- italicAct.setStatusTip(tr("Make the text italic"))
- italicAct.triggered.connect(italic)
-
- QFont italicFont = italicAct.font()
- italicFont.setItalic(True)
- italicAct.setFont(italicFont)
-
- setLineSpacingAct = QAction(tr("Set &Line Spacing..."), self)
- setLineSpacingAct.setStatusTip(tr("Change the gap between the lines of a "
- "paragraph"))
- setLineSpacingAct.triggered.connect(setLineSpacing)
-
- setParagraphSpacingAct = QAction(tr("Set &Paragraph Spacing..."), self)
- setLineSpacingAct.setStatusTip(tr("Change the gap between paragraphs"))
- setParagraphSpacingAct.triggered.connect(setParagraphSpacing)
-
- aboutAct = QAction(tr("&About"), self)
- aboutAct.setStatusTip(tr("Show the application's About box"))
- aboutAct.triggered.connect(about)
-
- aboutQtAct = QAction(tr("About &Qt"), self)
- aboutQtAct.setStatusTip(tr("Show the Qt library's About box"))
- aboutQtAct.triggered.connect(qApp.aboutQt)
- aboutQtAct.triggered.connect(aboutQt)
-
- leftAlignAct = QAction(tr("&Left Align"), self)
- leftAlignAct.setCheckable(True)
- leftAlignAct.setShortcut(tr("Ctrl+L"))
- leftAlignAct.setStatusTip(tr("Left align the selected text"))
- leftAlignAct.triggered.connect(leftAlign)
-
- rightAlignAct = QAction(tr("&Right Align"), self)
- rightAlignAct.setCheckable(True)
- rightAlignAct.setShortcut(tr("Ctrl+R"))
- rightAlignAct.setStatusTip(tr("Right align the selected text"))
- rightAlignAct.triggered.connect(rightAlign)
-
- justifyAct = QAction(tr("&Justify"), self)
- justifyAct.setCheckable(True)
- justifyAct.setShortcut(tr("Ctrl+J"))
- justifyAct.setStatusTip(tr("Justify the selected text"))
- justifyAct.triggered.connect(justify)
-
- centerAct = QAction(tr("&Center"), self)
- centerAct.setCheckable(True)
- centerAct.setShortcut(tr("Ctrl+E"))
- centerAct.setStatusTip(tr("Center the selected text"))
- centerAct.triggered.connect(center)
-
-//! [6] //! [7]
- alignmentGroup = QActionGroup(self)
- alignmentGroup.addAction(leftAlignAct)
- alignmentGroup.addAction(rightAlignAct)
- alignmentGroup.addAction(justifyAct)
- alignmentGroup.addAction(centerAct)
- leftAlignAct.setChecked(True)
-//! [6]
-
-//! [7]
-
-//! [8]
-def createMenus(self):
-
-//! [9] //! [10]
- fileMenu = menuBar().addMenu(tr("&File"))
- fileMenu.addAction(Act)
-//! [9]
- fileMenu.addAction(openAct)
-//! [10]
- fileMenu.addAction(saveAct)
- fileMenu.addAction(printAct)
-//! [11]
- fileMenu.addSeparator()
-//! [11]
- fileMenu.addAction(exitAct)
-
- editMenu = menuBar().addMenu(tr("&Edit"))
- editMenu.addAction(undoAct)
- editMenu.addAction(redoAct)
- editMenu.addSeparator()
- editMenu.addAction(cutAct)
- editMenu.addAction(copyAct)
- editMenu.addAction(pasteAct)
- editMenu.addSeparator()
-
- helpMenu = menuBar().addMenu(tr("&Help"))
- helpMenu.addAction(aboutAct)
- helpMenu.addAction(aboutQtAct)
-//! [8]
-
-//! [12]
- formatMenu = editMenu.addMenu(tr("&Format"))
- formatMenu.addAction(boldAct)
- formatMenu.addAction(italicAct)
- formatMenu.addSeparator()->setText(tr("Alignment"))
- formatMenu.addAction(leftAlignAct)
- formatMenu.addAction(rightAlignAct)
- formatMenu.addAction(justifyAct)
- formatMenu.addAction(centerAct)
- formatMenu.addSeparator()
- formatMenu.addAction(setLineSpacingAct)
- formatMenu.addAction(setParagraphSpacingAct)
-//! [12]
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/sdi/mainwindow.cpp b/sources/pyside6/doc/codesnippets/examples/mainwindows/sdi/mainwindow.cpp
deleted file mode 100644
index de169b20d..000000000
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/sdi/mainwindow.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [implicit tr context]
-def createMenus(self):
- fileMenu = menuBar().addMenu("&File")
-//! [implicit tr context]
-
-//! [0]
- fileToolBar = addToolBar("File")
- fileToolBar.addAction(newAct)
- fileToolBar.addAction(openAct)
-//! [0]