aboutsummaryrefslogtreecommitdiffstats
path: root/examples/richtext
diff options
context:
space:
mode:
Diffstat (limited to 'examples/richtext')
-rwxr-xr-xexamples/richtext/orderform.py99
-rwxr-xr-xexamples/richtext/syntaxhighlighter.py69
-rwxr-xr-xexamples/richtext/syntaxhighlighter/syntaxhighlighter.py63
-rwxr-xr-xexamples/richtext/textobject/textobject.py65
4 files changed, 230 insertions, 66 deletions
diff --git a/examples/richtext/orderform.py b/examples/richtext/orderform.py
index 423725a..e068db2 100755
--- a/examples/richtext/orderform.py
+++ b/examples/richtext/orderform.py
@@ -1,15 +1,56 @@
#!/usr/bin/env python
-"""PyQt4 port of the richtext/orderform example from Qt v4.x"""
-
-from PySide2 import QtCore, QtGui
-
-
-class MainWindow(QtGui.QMainWindow):
+#############################################################################
+##
+## Copyright (C) 2013 Riverbank Computing Limited.
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the PySide examples of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:BSD$
+## 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$
+##
+#############################################################################
+
+"""PySide2 port of the widgets/richtext/orderform example from Qt v5.x"""
+
+from PySide2 import QtCore, QtGui, QtWidgets, QtPrintSupport
+
+
+class MainWindow(QtWidgets.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
- fileMenu = QtGui.QMenu("&File", self)
+ fileMenu = QtWidgets.QMenu("&File", self)
newAction = fileMenu.addAction("&New...")
newAction.setShortcut("Ctrl+N")
self.printAction = fileMenu.addAction("&Print...", self.printFile)
@@ -19,7 +60,7 @@ class MainWindow(QtGui.QMainWindow):
quitAction.setShortcut("Ctrl+Q")
self.menuBar().addMenu(fileMenu)
- self.letters = QtGui.QTabWidget()
+ self.letters = QtWidgets.QTabWidget()
newAction.triggered.connect(self.openDialog)
quitAction.triggered.connect(self.close)
@@ -28,7 +69,7 @@ class MainWindow(QtGui.QMainWindow):
self.setWindowTitle("Order Form")
def createLetter(self, name, address, orderItems, sendOffers):
- editor = QtGui.QTextEdit()
+ editor = QtWidgets.QTextEdit()
tabIndex = self.letters.addTab(editor, name)
self.letters.setCurrentIndex(tabIndex)
@@ -147,49 +188,49 @@ class MainWindow(QtGui.QMainWindow):
def openDialog(self):
dialog = DetailsDialog("Enter Customer Details", self)
- if dialog.exec_() == QtGui.QDialog.Accepted:
+ if dialog.exec_() == QtWidgets.QDialog.Accepted:
self.createLetter(dialog.senderName(), dialog.senderAddress(),
dialog.orderItems(), dialog.sendOffers())
def printFile(self):
editor = self.letters.currentWidget()
- printer = QtGui.QPrinter()
+ printer = QtPrintSupport.QPrinter()
- dialog = QtGui.QPrintDialog(printer, self)
+ dialog = QtPrintSupport.QPrintDialog(printer, self)
dialog.setWindowTitle("Print Document")
if editor.textCursor().hasSelection():
- dialog.addEnabledOption(QtGui.QAbstractPrintDialog.PrintSelection)
+ dialog.addEnabledOption(QtPrintSupport.QAbstractPrintDialog.PrintSelection)
- if dialog.exec_() != QtGui.QDialog.Accepted:
+ if dialog.exec_() != QtWidgets.QDialog.Accepted:
return
editor.print_(printer)
-class DetailsDialog(QtGui.QDialog):
+class DetailsDialog(QtWidgets.QDialog):
def __init__(self, title, parent):
super(DetailsDialog, self).__init__(parent)
self.items = ("T-shirt", "Badge", "Reference book", "Coffee cup")
- nameLabel = QtGui.QLabel("Name:")
- addressLabel = QtGui.QLabel("Address:")
+ nameLabel = QtWidgets.QLabel("Name:")
+ addressLabel = QtWidgets.QLabel("Address:")
addressLabel.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
- self.nameEdit = QtGui.QLineEdit()
- self.addressEdit = QtGui.QTextEdit()
- self.offersCheckBox = QtGui.QCheckBox("Send information about "
+ self.nameEdit = QtWidgets.QLineEdit()
+ self.addressEdit = QtWidgets.QTextEdit()
+ self.offersCheckBox = QtWidgets.QCheckBox("Send information about "
"products and special offers:")
self.setupItemsTable()
- buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
+ buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
buttonBox.accepted.connect(self.verify)
buttonBox.rejected.connect(self.reject)
- mainLayout = QtGui.QGridLayout()
+ mainLayout = QtWidgets.QGridLayout()
mainLayout.addWidget(nameLabel, 0, 0)
mainLayout.addWidget(self.nameEdit, 0, 1)
mainLayout.addWidget(addressLabel, 1, 0)
@@ -202,13 +243,13 @@ class DetailsDialog(QtGui.QDialog):
self.setWindowTitle(title)
def setupItemsTable(self):
- self.itemsTable = QtGui.QTableWidget(len(self.items), 2)
+ self.itemsTable = QtWidgets.QTableWidget(len(self.items), 2)
for row, item in enumerate(self.items):
- name = QtGui.QTableWidgetItem(item)
+ name = QtWidgets.QTableWidgetItem(item)
name.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
self.itemsTable.setItem(row, 0, name)
- quantity = QtGui.QTableWidgetItem('1')
+ quantity = QtWidgets.QTableWidgetItem('1')
self.itemsTable.setItem(row, 1, quantity)
def orderItems(self):
@@ -235,12 +276,12 @@ class DetailsDialog(QtGui.QDialog):
self.accept()
return
- answer = QtGui.QMessageBox.warning(self, "Incomplete Form",
+ answer = QtWidgets.QMessageBox.warning(self, "Incomplete Form",
"The form does not contain all the necessary information.\n"
"Do you want to discard it?",
- QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
+ QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
- if answer == QtGui.QMessageBox.Yes:
+ if answer == QtWidgets.QMessageBox.Yes:
self.reject()
@@ -248,7 +289,7 @@ if __name__ == '__main__':
import sys
- app = QtGui.QApplication(sys.argv)
+ app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.resize(640, 480)
window.show()
diff --git a/examples/richtext/syntaxhighlighter.py b/examples/richtext/syntaxhighlighter.py
index afae910..8a14632 100755
--- a/examples/richtext/syntaxhighlighter.py
+++ b/examples/richtext/syntaxhighlighter.py
@@ -1,11 +1,52 @@
#!/usr/bin/env python
-"""PyQt4 port of the richtext/syntaxhighlighter example from Qt v4.x"""
-
-from PySide2 import QtCore, QtGui
-
-
-class MainWindow(QtGui.QMainWindow):
+#############################################################################
+##
+## Copyright (C) 2013 Riverbank Computing Limited.
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the PySide examples of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:BSD$
+## 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$
+##
+#############################################################################
+
+"""PySide2 port of the widgets/richtext/syntaxhighlighter example from Qt v5.x"""
+
+from PySide2 import QtCore, QtGui, QtWidgets
+
+
+class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
@@ -17,7 +58,7 @@ class MainWindow(QtGui.QMainWindow):
self.setWindowTitle("Syntax Highlighter")
def about(self):
- QtGui.QMessageBox.about(self, "About Syntax Highlighter",
+ QtWidgets.QMessageBox.about(self, "About Syntax Highlighter",
"<p>The <b>Syntax Highlighter</b> example shows how to " \
"perform simple syntax highlighting by subclassing the " \
"QSyntaxHighlighter class and describing highlighting " \
@@ -28,7 +69,7 @@ class MainWindow(QtGui.QMainWindow):
def openFile(self, path=None):
if not path:
- path = QtGui.QFileDialog.getOpenFileName(self, "Open File",
+ path = QtWidgets.QFileDialog.getOpenFileName(self, "Open File",
'', "C++ Files (*.cpp *.h)")
if path:
@@ -51,25 +92,25 @@ class MainWindow(QtGui.QMainWindow):
font.setFixedPitch(True)
font.setPointSize(10)
- self.editor = QtGui.QTextEdit()
+ self.editor = QtWidgets.QTextEdit()
self.editor.setFont(font)
self.highlighter = Highlighter(self.editor.document())
def setupFileMenu(self):
- fileMenu = QtGui.QMenu("&File", self)
+ fileMenu = QtWidgets.QMenu("&File", self)
self.menuBar().addMenu(fileMenu)
fileMenu.addAction("&New...", self.newFile, "Ctrl+N")
fileMenu.addAction("&Open...", self.openFile, "Ctrl+O")
- fileMenu.addAction("E&xit", QtGui.qApp.quit, "Ctrl+Q")
+ fileMenu.addAction("E&xit", QtWidgets.qApp.quit, "Ctrl+Q")
def setupHelpMenu(self):
- helpMenu = QtGui.QMenu("&Help", self)
+ helpMenu = QtWidgets.QMenu("&Help", self)
self.menuBar().addMenu(helpMenu)
helpMenu.addAction("&About", self.about)
- helpMenu.addAction("About &Qt", QtGui.qApp.aboutQt)
+ helpMenu.addAction("About &Qt", QtWidgets.qApp.aboutQt)
class Highlighter(QtGui.QSyntaxHighlighter):
@@ -155,7 +196,7 @@ if __name__ == '__main__':
import sys
- app = QtGui.QApplication(sys.argv)
+ app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.resize(640, 512)
window.show()
diff --git a/examples/richtext/syntaxhighlighter/syntaxhighlighter.py b/examples/richtext/syntaxhighlighter/syntaxhighlighter.py
index abde257..4b3fe83 100755
--- a/examples/richtext/syntaxhighlighter/syntaxhighlighter.py
+++ b/examples/richtext/syntaxhighlighter/syntaxhighlighter.py
@@ -1,17 +1,58 @@
#!/usr/bin/env python
-"""PySide port of the richtext/syntaxhighlighter example from Qt v4.x"""
+############################################################################
+##
+## Copyright (C) 2013 Riverbank Computing Limited.
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the PySide examples of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:BSD$
+## 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$
+##
+#############################################################################
+
+"""PySide2 port of the widgets/richtext/syntaxhighlighter example from Qt v5.x"""
import sys
import re
-from PySide2 import QtCore, QtGui
+from PySide2 import QtCore, QtGui, QtWidgets
import syntaxhighlighter_rc
-class MainWindow(QtGui.QMainWindow):
+class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
- QtGui.QMainWindow.__init__(self, parent)
+ QtWidgets.QMainWindow.__init__(self, parent)
self.highlighter = Highlighter()
@@ -28,7 +69,7 @@ class MainWindow(QtGui.QMainWindow):
fileName = path
if fileName=="":
- fileName,_ = QtGui.QFileDialog.getOpenFileName(self, self.tr("Open File"), "",
+ fileName,_ = QtWidgets.QFileDialog.getOpenFileName(self, self.tr("Open File"), "",
"qmake Files (*.pro *.prf *.pri)")
if fileName!="":
@@ -61,25 +102,25 @@ class MainWindow(QtGui.QMainWindow):
font.setFixedPitch(True)
font.setPointSize(10)
- self.editor = QtGui.QTextEdit()
+ self.editor = QtWidgets.QTextEdit()
self.editor.setFont(font)
self.highlighter.addToDocument(self.editor.document())
def setupFileMenu(self):
- fileMenu = QtGui.QMenu(self.tr("&File"), self)
+ fileMenu = QtWidgets.QMenu(self.tr("&File"), self)
self.menuBar().addMenu(fileMenu)
- newFileAct = QtGui.QAction(self.tr("&New..."), self)
+ newFileAct = QtWidgets.QAction(self.tr("&New..."), self)
newFileAct.setShortcut(QtGui.QKeySequence(self.tr("Ctrl+N", "File|New")))
self.connect(newFileAct, QtCore.SIGNAL("triggered()"), self.newFile)
fileMenu.addAction(newFileAct)
- openFileAct = QtGui.QAction(self.tr("&Open..."), self)
+ openFileAct = QtWidgets.QAction(self.tr("&Open..."), self)
openFileAct.setShortcut(QtGui.QKeySequence(self.tr("Ctrl+O", "File|Open")))
self.connect(openFileAct, QtCore.SIGNAL("triggered()"), self.openFile)
fileMenu.addAction(openFileAct)
- fileMenu.addAction(self.tr("E&xit"), QtGui.qApp, QtCore.SLOT("quit()"),
+ fileMenu.addAction(self.tr("E&xit"), QtWidgets.qApp, QtCore.SLOT("quit()"),
QtGui.QKeySequence(self.tr("Ctrl+Q", "File|Exit")))
@@ -131,7 +172,7 @@ class Highlighter(QtCore.QObject):
if __name__ == '__main__':
- app = QtGui.QApplication(sys.argv)
+ app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.resize(640, 512)
window.show()
diff --git a/examples/richtext/textobject/textobject.py b/examples/richtext/textobject/textobject.py
index dc3dcd4..3e7b75d 100755
--- a/examples/richtext/textobject/textobject.py
+++ b/examples/richtext/textobject/textobject.py
@@ -1,8 +1,49 @@
#!/usr/bin/env python
-"""PyQt4 port of the richtext/textobject example from Qt v4.x"""
-
-from PySide2 import QtCore, QtGui, QtSvg
+#############################################################################
+##
+## Copyright (C) 2013 Riverbank Computing Limited.
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the PySide examples of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:BSD$
+## 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$
+##
+#############################################################################
+
+"""PySide2 port of the widgets/richtext/textobject example from Qt v5.x"""
+
+from PySide2 import QtCore, QtGui, QtWidgets, QtSvg
class SvgTextObject(QtCore.QObject, QtGui.QTextObjectInterface):
@@ -21,7 +62,7 @@ class SvgTextObject(QtCore.QObject, QtGui.QTextObjectInterface):
renderer.render(painter, rect)
-class Window(QtGui.QWidget):
+class Window(QtWidgets.QWidget):
SvgTextFormat = QtGui.QTextFormat.UserObject + 1
@@ -40,7 +81,7 @@ class Window(QtGui.QWidget):
file = QtCore.QFile(fileName)
if not file.open(QtCore.QIODevice.ReadOnly):
- QtGui.QMessageBox.warning(self, self.tr("Error Opening File"),
+ QtWidgets.QMessageBox.warning(self, self.tr("Error Opening File"),
self.tr("Could not open '%1'").arg(fileName))
svgData = file.readAll()
@@ -58,21 +99,21 @@ class Window(QtGui.QWidget):
self.textEdit.document().documentLayout().registerHandler(Window.SvgTextFormat, svgInterface)
def setupGui(self):
- fileNameLabel = QtGui.QLabel(self.tr("Svg File Name:"))
- self.fileNameLineEdit = QtGui.QLineEdit()
- insertTextObjectButton = QtGui.QPushButton(self.tr("Insert Image"))
+ fileNameLabel = QtWidgets.QLabel(self.tr("Svg File Name:"))
+ self.fileNameLineEdit = QtWidgets.QLineEdit()
+ insertTextObjectButton = QtWidgets.QPushButton(self.tr("Insert Image"))
self.fileNameLineEdit.setText('./files/heart.svg')
QtCore.QObject.connect(insertTextObjectButton, QtCore.SIGNAL('clicked()'), self.insertTextObject)
- bottomLayout = QtGui.QHBoxLayout()
+ bottomLayout = QtWidgets.QHBoxLayout()
bottomLayout.addWidget(fileNameLabel)
bottomLayout.addWidget(self.fileNameLineEdit)
bottomLayout.addWidget(insertTextObjectButton)
- self.textEdit = QtGui.QTextEdit()
+ self.textEdit = QtWidgets.QTextEdit()
- mainLayout = QtGui.QVBoxLayout()
+ mainLayout = QtWidgets.QVBoxLayout()
mainLayout.addWidget(self.textEdit)
mainLayout.addLayout(bottomLayout)
@@ -83,7 +124,7 @@ if __name__ == '__main__':
import sys
- app = QtGui.QApplication(sys.argv)
+ app = QtWidgets.QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec_())