aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2020-12-30 02:58:00 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-04 18:15:31 +0000
commitac07f3f6ec396243f63a3a604613fe805cf190e2 (patch)
tree98817f27a087c14a7021adb643caf40d88ee481e
parent98919e94556eb96a7a0afb5e160c7634c4fbf4ef (diff)
doc/tests: update old style print
There were some leftovers from Python 2 still around our code, this patch only covers the 'print' cases. Change-Id: Icf574be6a40cdb233d3c410c2ec831d2d09bb735 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit b3a8c9898cca52b63d270a54651ec71de9b32238) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qthreadpool.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdir.cpp12
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdiriterator.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qfileinfo.cpp4
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qurl.cpp6
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp6
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp6
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_image_qimagereader.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_util_qcompleter.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp4
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_socket_qabstractsocket.cpp4
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp6
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_opengl_qgl.cpp8
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptengine.cpp8
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalue.cpp4
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalueiterator.cpp6
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlerror.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp6
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_xml_dom_qdom.cpp8
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/image/supportedformat.cpp8
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/printing-qprinter/errors.cpp8
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-listfiles/main.cpp2
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-namefilters/main.cpp4
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/qxmlschemavalidator/main.cpp16
-rw-r--r--sources/pyside6/doc/codesnippets/doc/src/snippets/sqldatabase/sqldatabase.py12
-rw-r--r--sources/pyside6/doc/codesnippets/examples/dbus/example-client.py2
-rw-r--r--sources/pyside6/doc/codesnippets/examples/dbus/example-server.py2
-rw-r--r--sources/pyside6/doc/tutorials/basictutorial/dialog.rst4
-rw-r--r--sources/pyside6/tests/util/processtimer.py4
-rw-r--r--sources/pyside6/tests/util/pyqtcheck.py8
34 files changed, 88 insertions, 88 deletions
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qthreadpool.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qthreadpool.cpp
index f552f3429..3492943a0 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qthreadpool.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qthreadpool.cpp
@@ -51,7 +51,7 @@
//! [0]
class HelloWorldTask(QRunnable):
def run(self):
- print "Hello world from thread", QThread.currentThread()
+ print("Hello world from thread", QThread.currentThread())
hello = HelloWorldTask()
# QThreadPool takes ownership and deletes 'hello' automatically
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdir.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdir.cpp
index 16f20c236..11a56ea4c 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdir.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdir.cpp
@@ -78,18 +78,18 @@ absolutePath = directory.absoluteFilePath("contents.txt")
//! [4]
dir = QDir("example")
if not dir.exists():
- print "Cannot find the example directory"
+ print("Cannot find the example directory")
//! [4]
//! [5]
dir = QDir.root() # "/"
if not dir.cd("tmp"): # "/tmp"
- print "Cannot find the \"/tmp\" directory"
+ print("Cannot find the \"/tmp\" directory")
else:
file = QFile(dir.filePath("ex1.txt")) # "/tmp/ex1.txt"
if !file.open(QIODevice.ReadWrite):
- print "Cannot create the file %s" % (file.name())
+ print("Cannot create the file %s" % (file.name()))
//! [5]
@@ -127,7 +127,7 @@ file = QFile("docs:design.odf") # will look in the :/embeddedDocuments resou
dir = QDir("/tmp/root_link")
dir = dir.canonicalPath()
if dir.isRoot():
- print "It is a root link"
+ print("It is a root link")
//! [9]
@@ -136,7 +136,7 @@ if dir.isRoot():
d1 = QDir("/usr/local/bin")
d2 = QDir("bin")
if d1 == d2:
- print "They're the same"
+ print("They're the same")
//! [10]
@@ -146,7 +146,7 @@ d1 = QDir("/usr/local/bin")
d1.setFilter(QDir.Executable)
d2 = QDir("bin")
if d1 != d2:
- print "They differ"
+ print("They differ")
//! [11]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdiriterator.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdiriterator.cpp
index be68a5dbb..3cc4ae63e 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdiriterator.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qdiriterator.cpp
@@ -51,7 +51,7 @@
//! [0]
it = QDirIterator("/etc", QDirIterator.Subdirectories)
while it.hasNext():
- print it.next()
+ print(it.next())
# /etc/.
# /etc/..
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qfileinfo.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qfileinfo.cpp
index 1027525db..c362e2fff 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qfileinfo.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qfileinfo.cpp
@@ -142,7 +142,7 @@ if info.isSymLink():
//! [10]
fi = QFileInfo("/tmp/archive.tar.gz")
if fi.permission(QFile.WriteUser | QFile.ReadGroup):
- print "I can change the file; my group can read the file"
+ print("I can change the file; my group can read the file")
if fi.permission(QFile.WriteGroup | QFile.WriteOther):
- print "The group or others can change the file"
+ print("The group or others can change the file")
//! [10]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qurl.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qurl.cpp
index d32a7b9c7..de50b7f8a 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qurl.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qurl.cpp
@@ -62,7 +62,7 @@ url = QUrl.fromEncoded("http://qtsoftware.com/List%20of%20holidays.xml")
//! [2]
def checkUrl(url):
if !url.isValid():
- print "Invalid URL: %s" % url.toString()
+ print("Invalid URL: %s" % url.toString())
return False
return True
@@ -84,13 +84,13 @@ http://www.example.com/cgi-bin/drawgraph.cgi?type-pie/color-green
//! [5]
baseUrl = QUrl("http://qtsoftware.com/support")
relativeUrl = QUrl("../products/solutions")
-print baseUrl.resolved(relativeUrl).toString()
+print(baseUrl.resolved(relativeUrl).toString())
# prints "http://qtsoftware.com/products/solutions"
//! [5]
//! [6]
ba = QUrl.toPercentEncoding("{a fishy string?}", "{}", "s")
-print ba
+print(ba)
# prints "{a fi%73hy %73tring%3F}"
//! [6]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp
index bb0bc7de4..e2b6356b9 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp
@@ -70,7 +70,7 @@ ba[4] = 'o'
//! [2]
for i in range(0, ba.size()):
if ba.at(i) >= 'a' and ba.at(i) <= 'f':
- print "Found character in range [a-f]"
+ print("Found character in range [a-f]")
//! [2]
@@ -86,7 +86,7 @@ x.replace(5, 3, "&") # x == "rock & roll"
ba = QByteArray("We must be <b>bold</b>, very <b>bold</b>")
j = 0
while (j = ba.indexOf("<b>", j)) != -1:
- print "Found <b> tag at index position %d" % j
+ print("Found <b> tag at index position %d" % j)
++j
//! [4]
@@ -120,7 +120,7 @@ QByteArray("abc").isEmpty() # returns false
//! [8]
ba = QByteArray("Hello world");
-print ba.data();
+print(ba.data())
//! [8]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp
index ea8c04453..2d1b9eb0d 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_corelib_tools_qdatetime.cpp
@@ -122,7 +122,7 @@ QTime.isValid(22, 5, 62) # returns False
t = QTime()
t.start()
some_lengthy_task()
-print ("Time elapsed: %d ms" % t.elapsed())
+print("Time elapsed: %d ms" % t.elapsed())
//! [10]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
index d13cee846..06062cf79 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
@@ -113,16 +113,16 @@ view.render(painter,
//! [5]
def mousePressEvent(self, event):
- print "There are", items(event->pos()).size(), "items at position", mapToScene(event->pos())
+ print("There are", items(event->pos()).size(), "items at position", mapToScene(event->pos()))
//! [5]
//! [6]
def mousePressEvent(self, event):
if (item = itemAt(event.pos()):
- print "You clicked on item", item
+ print("You clicked on item", item)
else:
- print "You didn't click on an item."
+ print("You didn't click on an item.")
//! [6]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_image_qimagereader.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_image_qimagereader.cpp
index 2e36ba8b2..e058c3a15 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_image_qimagereader.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_image_qimagereader.cpp
@@ -71,5 +71,5 @@ if reader.read(icon):
//! [3]
reader = QImageReader(":/image.png")
if reader.supportsOption(QImageIOHandler.Size):
- print "Size:", str(reader.size())
+ print("Size:", str(reader.size()))
//! [3]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_util_qcompleter.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_util_qcompleter.cpp
index a9ba16a65..370404948 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_util_qcompleter.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_gui_util_qcompleter.cpp
@@ -69,6 +69,6 @@ lineEdit.setCompleter(completer)
//! [2]
i = 0
while completer.setCurrentRow(i):
- print "%s is match number %d" % (completer.currentCompletion(), i)
+ print("%s is match number %d" % (completer.currentCompletion(), i))
i += 1
//! [2]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
index b1430a499..51128fa6b 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_kernel_qhostinfo.cpp
@@ -70,11 +70,11 @@ QHostInfo.lookupHost("www.kde.org", self.lookedUp)
//! [3]
def lookedUp(host):
if host.error() != QHostInfo.NoError:
- print "Lookup failed: %s" % host.errorString()
+ print("Lookup failed: %s" % host.errorString())
return
for address in host.addresses():
- print "Found address: %s" % address.toString()
+ print("Found address: %s" % address.toString())
//! [3]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_socket_qabstractsocket.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_socket_qabstractsocket.cpp
index ea70b1fcf..1da214530 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_socket_qabstractsocket.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_socket_qabstractsocket.cpp
@@ -51,7 +51,7 @@
//! [0]
socket.connectToHost("imap", 143)
if socket.waitForConnected(1000):
- print "Connected!"
+ print("Connected!")
//! [0]
@@ -59,7 +59,7 @@ if socket.waitForConnected(1000):
socket.disconnectFromHost()
if socket.state() == QAbstractSocket.UnconnectedState or \
socket.waitForDisconnected(1000):
- print "Disconnected!"
+ print("Disconnected!")
//! [1]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
index d13d4dd3c..a1e342a90 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslcertificate.cpp
@@ -50,5 +50,5 @@
//! [0]
for cert in QSslCertificate.fromPath('C:/ssl/certificate.*.pem', QSsL.Pem, QRegExp.Wildcard):
- print cert.issuerInfo(QSslCertificate.Organization)
+ print(cert.issuerInfo(QSslCertificate.Organization))
//! [0]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp
index d822b80c5..3b0d2a31e 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_network_ssl_qsslsocket.cpp
@@ -69,12 +69,12 @@ def incomingConnection(socketDescriptor):
socket = QSslSocket()
socket.connectToHostEncrypted("http.example.com", 443)
if not socket.waitForEncrypted():
- print socket.errorString()
+ print(socket.errorString())
return false
socket.write("GET / HTTP/1.0\r\n\r\n")
while socket.waitForReadyRead():
- print socket.readAll().data()
+ print(socket.readAll().data())
//! [2]
@@ -96,5 +96,5 @@ socket.setCiphers("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA")
//! [5]
socket.connectToHostEncrypted("imap", 993)
if socket.waitForEncrypted(1000):
- print "Encrypted!"
+ print("Encrypted!")
//! [5]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_opengl_qgl.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_opengl_qgl.cpp
index 264cf0888..761b50970 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_opengl_qgl.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_opengl_qgl.cpp
@@ -72,7 +72,7 @@ myWidget = MyGLWidget(fmt, ...)
if !myWidget.format().stereo():
# ok, goggles off
if !myWidget.format().hasOverlay():
- print "Cool hardware required"
+ print("Cool hardware required")
//! [2]
@@ -85,9 +85,9 @@ class MyGLWidget(QGLWidget):
QGLWidget.__init__(self, QGLFormat(QGL.StencilBuffer | QGL.AlphaChannel), parent)
if !format().stencil():
- print "Could not get stencil buffer results will be suboptimal"
+ print("Could not get stencil buffer results will be suboptimal")
if !format().alpha():
- print "Could not get alpha channel results will be suboptimal"
+ print("Could not get alpha channel results will be suboptimal")
...
//! [3]
@@ -146,7 +146,7 @@ class MyGLDrawer(QGLWidget):
glClearColor(0.0, 0.0, 0.0, 0.0)
glEnable(GL_DEPTH_TEST)
...
-
+
def resizeGL(self, w, h):
# setup viewport, projection etc.:
glViewport(0, 0, w, h)
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptengine.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptengine.cpp
index 4005e2c2b..a41a08739 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptengine.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptengine.cpp
@@ -85,7 +85,7 @@ myNumberPlusOne = myEngine.evaluate("myNumber + 1")
result = myEngine.evaluate(...)
if myEngine.hasUncaughtException():
line = myEngine.uncaughtExceptionLineNumber()
- print "uncaught exception at line", line, ":", result.toString()
+ print("uncaught exception at line", line, ":", result.toString())
//! [4]
@@ -96,7 +96,7 @@ myEngine.globalObject().setProperty("button", scriptButton)
myEngine.evaluate("button.checkable = True")
-print scriptButton.property("checkable").toBoolean()
+print(scriptButton.property("checkable").toBoolean())
scriptButton.property("show").call() # call the show() slot
//! [5]
@@ -146,7 +146,7 @@ engine.globalObject().setProperty("Foo", engine->Function(Foo, fooProto))
//! [10]
class Bar:
- ...
+ ...
def constructBar(context, engine):
bar = Bar()
@@ -301,7 +301,7 @@ qScriptRegisterSequenceMetaType<QVector<int> >(engine)
v = engine.evaluate("[5, 1, 3, 2]")
v.sort()
a = engine.toScriptValue(v)
-print a.toString() # outputs "[1, 2, 3, 5]"
+print(a.toString()) # outputs "[1, 2, 3, 5]"
//! [26]
//! [27]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalue.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalue.cpp
index 18109bd83..aec1ccdcf 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalue.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalue.cpp
@@ -71,13 +71,13 @@ engine.evaluate("somePerson = { firstName: 'John', lastName: 'Doe' }")
global_ = engine.globalObject()
fullName = global_.property("fullName")
who = global_.property("somePerson")
-print fullName.call(who).toString() # "John Doe"
+print(fullName.call(who).toString()) # "John Doe"
engine.evaluate("function cube(x) { return x * x * x; }")
QScriptValue cube = global_.property("cube")
args = QScriptValueList()
args << 3
-print cube.call(QScriptValue(), args).toNumber() # 27
+print(cube.call(QScriptValue(), args).toNumber()) # 27
//! [2]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalueiterator.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalueiterator.cpp
index f9401488e..9d8736e6a 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalueiterator.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_script_qscriptvalueiterator.cpp
@@ -54,7 +54,7 @@ object = QScriptValue()
it = QScriptValueIterator(object)
while it.hasNext():
it.next()
- print "%s:%s" % (it.name(), it.value().toString())
+ print("%s:%s" % (it.name(), it.value().toString()))
//! [0]
@@ -64,7 +64,7 @@ while obj.isObject():
it = QScriptValueIterator(obj)
while it.hasNext():
it.next()
- print it.name()
+ print(it.name())
obj = obj.prototype()
//! [1]
@@ -74,5 +74,5 @@ while it.hasNext():
it.next()
if it.flags() & QScriptValue::SkipInEnumeration:
continue
- print "found enumerated property: %s" % it.name()
+ print("found enumerated property: %s" % it.name())
//! [2]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlerror.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlerror.cpp
index ea0c8709a..1aa9e2772 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlerror.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlerror.cpp
@@ -52,5 +52,5 @@
model = QSqlQueryModel()
model.setQuery("select * from myTable")
if model.lastError().isValid():
- print model.lastError()
+ print(model.lastError())
//! [0]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp
index 8e323680b..ff02e287e 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp
@@ -57,11 +57,11 @@ SELECT forename, surname FROM people
q = QSqlQuery("select * from employees")
rec = q.record()
-print "Number of columns: %d" % rec.count()
+print("Number of columns: %d" % rec.count())
nameCol = rec.indexOf("name") # index of the field "name"
while q.next():
- print q.value(nameCol) # output all names
+ print(q.value(nameCol)) # output all names
//! [1]
@@ -76,7 +76,7 @@ names = ["Harald", "Boris", "Trond", ""]
q.addBindValue(names)
if not q.execBatch():
- print q.lastError()
+ print(q.lastError())
//! [2]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp
index 3ba3277d0..7f770a241 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp
@@ -61,7 +61,7 @@ q.bindValue(1, col2)
q.bindValue(2, col3)
if not q.execBatch():
- print q.lastError()
+ print(q.lastError())
//! [0]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp
index fc5c398ad..f4b836118 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp
@@ -58,5 +58,5 @@ while myModel.canFetchMore():
model = QSqlQueryModel()
model.setQuery("select * from MyTable")
if model.lastError().isValid():
- print model.lastError()
+ print(model.lastError())
//! [1]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_xml_dom_qdom.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_xml_dom_qdom.cpp
index 6396cbcdc..54d932ebd 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_xml_dom_qdom.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/code/src_xml_dom_qdom.cpp
@@ -74,7 +74,7 @@ n = d.firstChild()
while !n.isNull():
if n.isElement():
e = n.toElement()
- print "Element name: %s" % e.tagName()
+ print("Element name: %s" % e.tagName())
break
n = n.nextSibling()
//! [1]
@@ -124,10 +124,10 @@ QDomElement element4 = document.createElement("MyElement")
e = # some QDomElement...
#...
a = e.attributeNode("href")
-print a.value() # prints "http://qt-project.org.com"
+print(a.value()) # prints "http://qt-project.org.com"
a.setValue("http://qt-project.org/doc") # change the node's attribute
a2 = e.attributeNode("href")
-print a2.value() # prints "http://qt-project.org/doc"
+print(a2.value()) # prints "http://qt-project.org/doc"
//! [8]
@@ -204,7 +204,7 @@ n = docElem.firstChild()
while not n.isNull():
e = n.toElement() # try to convert the node to an element.
if not e.isNull():
- print e.tagName() # the node really is an element.
+ print(e.tagName()) # the node really is an element.
n = n.nextSibling()
}
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/image/supportedformat.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/image/supportedformat.cpp
index 2d8459f3e..969ce5866 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/image/supportedformat.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/image/supportedformat.cpp
@@ -49,8 +49,8 @@
****************************************************************************/
//! [0]
- writer = QImageWriter()
- writer.setFormat("png")
- if writer.supportsOption(QImageIOHandler.Description):
- print "Png supports embedded text"
+ writer = QImageWriter()
+ writer.setFormat("png")
+ if writer.supportsOption(QImageIOHandler.Description):
+ print("Png supports embedded text")
//! [0]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/printing-qprinter/errors.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/printing-qprinter/errors.cpp
index 8c71d1e81..b5618af9d 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/printing-qprinter/errors.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/printing-qprinter/errors.cpp
@@ -54,14 +54,14 @@
printer.setOutputFileName("/foobar/nonwritable.pdf")
QPainter painter
if painter.begin(printer): # failed to open file
- print "failed to open file, is it writable?"
+ print("failed to open file, is it writable?")
return 1
-
+
painter.drawText(10, 10, "Test")
if !printer.Page():
- print "failed in flushing page to disk, disk full?"
+ print("failed in flushing page to disk, disk full?")
return 1
-
+
painter.drawText(10, 10, "Test 2")
painter.end()
//! [0]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-listfiles/main.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-listfiles/main.cpp
index d0189027a..204fac414 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-listfiles/main.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-listfiles/main.cpp
@@ -59,6 +59,6 @@ directory.setFilter(QDir.Files | QDir.Hidden | QDir.NoSymLinks)
directory.setSorting(QDir.Size | QDir.Reversed)
for entry in directory.entryInfoList():
- print "%s %s" % (entry.size(), entry.fileName())
+ print("%s %s" % (entry.size(), entry.fileName()))
//! [0]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-namefilters/main.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-namefilters/main.cpp
index 5a323a97f..7f6c4b083 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-namefilters/main.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/qdir-namefilters/main.cpp
@@ -62,7 +62,7 @@ def main():
//
lst = d.entryInfoList()
- print " Bytes Filename"
+ print(" Bytes Filename")
for fileInfo in lst:
- print '%d %s' % (fileInfo.size(), fileInfo.fileName())
+ print('%d %s' % (fileInfo.size(), fileInfo.fileName()))
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/qxmlschemavalidator/main.cpp b/sources/pyside6/doc/codesnippets/doc/src/snippets/qxmlschemavalidator/main.cpp
index 0d81b914a..9e57186b9 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/qxmlschemavalidator/main.cpp
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/qxmlschemavalidator/main.cpp
@@ -56,9 +56,9 @@ def validateFromUrl():
validator = QXmlSchemaValidator(schema)
if validator.validate(url):
- print "instance document is valid"
+ print("instance document is valid")
else:
- print "instance document is invalid"
+ print("instance document is invalid")
//! [0]
def validateFromFile():
@@ -70,9 +70,9 @@ def validateFromFile():
validator = QXmlSchemaValidator(schema)
if validator.validate(file, QUrl.fromLocalFile(file.fileName())):
- print "instance document is valid"
+ print("instance document is valid")
else:
- print "instance document is invalid"
+ print("instance document is invalid")
//! [1]
}
@@ -87,9 +87,9 @@ def validateFromData():
QXmlSchemaValidator validator(schema)
if validator.validate(buffer):
- print "instance document is valid"
+ print("instance document is valid")
else:
- print "instance document is invalid"
+ print("instance document is invalid")
//! [2]
def validateComplete():
@@ -105,8 +105,8 @@ def validateComplete():
validator = QXmlSchemaValidator(schema)
if validator.validate(file, QUrl.fromLocalFile(file.fileName())):
- print "instance document is valid"
+ print("instance document is valid")
else:
- print "instance document is invalid"
+ print("instance document is invalid")
}
//! [3]
diff --git a/sources/pyside6/doc/codesnippets/doc/src/snippets/sqldatabase/sqldatabase.py b/sources/pyside6/doc/codesnippets/doc/src/snippets/sqldatabase/sqldatabase.py
index 106dc5f7f..747f7b983 100644
--- a/sources/pyside6/doc/codesnippets/doc/src/snippets/sqldatabase/sqldatabase.py
+++ b/sources/pyside6/doc/codesnippets/doc/src/snippets/sqldatabase/sqldatabase.py
@@ -171,14 +171,14 @@ def QSqlQuery_snippets():
i = query.boundValues()
while i.hasNext():
i.next()
- print i.key(), ": ", i.value()
+ print(i.key(), ": ", i.value())
//! [14]
# examine with positional binding
//! [15]
list_ = query.boundValues().values()
for item in list:
- print item
+ print(item)
//! [15]
def QSqlQueryModel_snippets():
@@ -211,7 +211,7 @@ def QSqlQueryModel_snippets():
for row in range(model.rowCount()):
for (col in range(model.columnCount())):
- print model.data(model.index(row, col))
+ print(model.data(model.index(row, col)))
class MyModel(QSqlQueryModel)
@@ -284,7 +284,7 @@ def sql_intro_snippets():
while query.next():
name = query.value(0)
salary = query.value(1)
- print name, salary
+ print(name, salary)
//! [32]
# FEATURE
@@ -364,7 +364,7 @@ def sql_intro_snippets():
for i in range(model.rowCount()):
_id = model.record(i).value("id")
name = model.record(i).value("name")
- print _id, name
+ print(_id, name)
//! [40]
}
@@ -381,7 +381,7 @@ def sql_intro_snippets():
for i in range(model.rowCount()):
name = model.record(i).value("name")
salary = model.record(i).value("salary")
- print "%s: %d" % (name, salary)
+ print("%s: %d" % (name, salary))
//! [41]
diff --git a/sources/pyside6/doc/codesnippets/examples/dbus/example-client.py b/sources/pyside6/doc/codesnippets/examples/dbus/example-client.py
index 663c02e96..9f978482d 100644
--- a/sources/pyside6/doc/codesnippets/examples/dbus/example-client.py
+++ b/sources/pyside6/doc/codesnippets/examples/dbus/example-client.py
@@ -66,7 +66,7 @@ from PySide6.QtCore import *
# signal handler
def button_clicked():
- print "button clicked"
+ print("button clicked")
# main function
if __name__ == '__main__':
diff --git a/sources/pyside6/doc/codesnippets/examples/dbus/example-server.py b/sources/pyside6/doc/codesnippets/examples/dbus/example-server.py
index 78f6eac2e..d18c4a578 100644
--- a/sources/pyside6/doc/codesnippets/examples/dbus/example-server.py
+++ b/sources/pyside6/doc/codesnippets/examples/dbus/example-server.py
@@ -114,6 +114,6 @@ if __name__ == '__main__':
# Export the object
widget = DBusWidget(session_bus, '/DBusWidget')
- print "Running example service."
+ print("Running example service.")
app.exec_()
diff --git a/sources/pyside6/doc/tutorials/basictutorial/dialog.rst b/sources/pyside6/doc/tutorials/basictutorial/dialog.rst
index 0ced571db..8246ddd7a 100644
--- a/sources/pyside6/doc/tutorials/basictutorial/dialog.rst
+++ b/sources/pyside6/doc/tutorials/basictutorial/dialog.rst
@@ -88,7 +88,7 @@ the Form, so you have to add it after the `init()` function:
# Greets the user
def greetings(self):
- print ("Hello {}".format(self.edit.text()))
+ print("Hello {}".format(self.edit.text()))
Our function just prints the contents of the `QLineEdit` to the
python console. We have access to the text by means of the
@@ -133,7 +133,7 @@ Here is the complete code for this tutorial:
# Greets the user
def greetings(self):
- print ("Hello %s" % self.edit.text())
+ print("Hello %s" % self.edit.text())
if __name__ == '__main__':
# Create the Qt Application
diff --git a/sources/pyside6/tests/util/processtimer.py b/sources/pyside6/tests/util/processtimer.py
index 61a39dbf0..74fe93648 100644
--- a/sources/pyside6/tests/util/processtimer.py
+++ b/sources/pyside6/tests/util/processtimer.py
@@ -67,11 +67,11 @@ if __name__ == "__main__":
try:
t.waitfor()
except TimeoutException:
- print "timeout - PID: %d" % (t.proc.pid)
+ print("timeout - PID: %d" % (t.proc.pid))
#TODO: detect SO and kill accordingly
#Linux
os.kill(t.proc.pid, 9)
#Windows (not tested)
#subprocess.Popen("taskkill /F /T /PID %i"%handle.pid , shell=True)
- print "exit code: %d" % (t.proc.poll())
+ print("exit code: %d" % (t.proc.poll()))
diff --git a/sources/pyside6/tests/util/pyqtcheck.py b/sources/pyside6/tests/util/pyqtcheck.py
index d6cac920f..6bac533ce 100644
--- a/sources/pyside6/tests/util/pyqtcheck.py
+++ b/sources/pyside6/tests/util/pyqtcheck.py
@@ -40,9 +40,9 @@ def search(klass, method=None):
for module in modules:
try:
klass_obj = getattr(module, klass)
- print "%s *found* on module %s" % (klass, module.__name__)
+ print("%s *found* on module %s" % (klass, module.__name__))
except AttributeError:
- print "%s not found on module %s" % (klass, module.__name__)
+ print("%s not found on module %s" % (klass, module.__name__))
continue
if method is None:
@@ -53,9 +53,9 @@ def search(klass, method=None):
meth_name = ".".join([klass, method])
klass_name = ".".join([module.__name__, klass])
- print "\"%s\" *found* on class %s" % (meth_name, klass_name)
+ print("\"%s\" *found* on class %s" % (meth_name, klass_name))
except AttributeError:
- print "\"%s\" not found on class %s" % (method, klass)
+ print("\"%s\" not found on class %s" % (method, klass))
def main(argv=None):