Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.9' into dev
Browse files Browse the repository at this point in the history
Change-Id: I7f2e832b6642d84028a2a2fb39c6ac896136b7c3
  • Loading branch information
FriedemannKleint committed Oct 13, 2017
2 parents 29bf933 + b43152d commit bd0c77f
Show file tree
Hide file tree
Showing 17 changed files with 382 additions and 20 deletions.
103 changes: 103 additions & 0 deletions examples.pyqtc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
examples/charts/memoryusage.py
examples/corelib/threads/mandelbrot.py
examples/corelib/tools/codecs/codecs.py
examples/corelib/tools/regexp.py
examples/corelib/tools/settingseditor/settingseditor.py
examples/declarative/extending/chapter1-basics/basics.py
examples/declarative/extending/chapter2-methods/methods.py
examples/declarative/extending/chapter3-bindings/bindings.py
examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
examples/declarative/extending/chapter5-listproperties/listproperties.py
examples/declarative/scrolling.py
examples/declarative/signals/pytoqml1/main.py
examples/declarative/signals/qmltopy1/main.py
examples/declarative/signals/qmltopy2/main.py
examples/declarative/signals/qmltopy3/main.py
examples/declarative/signals/qmltopy4/main.py
examples/declarative/usingmodel.py
examples/macextras/macpasteboardmime.py
examples/multimedia/audiooutput.py
examples/multimedia/camera.py
examples/multimedia/player.py
examples/network/blockingfortuneclient.py
examples/network/fortuneclient.py
examples/network/fortuneserver.py
examples/network/threadedfortuneserver.py
examples/opengl/2dpainting.py
examples/opengl/grabber.py
examples/opengl/hellogl.py
examples/opengl/overpainting.py
examples/opengl/samplebuffers.py
examples/opengl/textures/textures.py
examples/script/helloscript.py
examples/texttospeech/texttospeech.py
examples/tutorial/t1.py
examples/tutorial/t10.py
examples/tutorial/t11.py
examples/tutorial/t12.py
examples/tutorial/t13.py
examples/tutorial/t14.py
examples/tutorial/t2.py
examples/tutorial/t3.py
examples/tutorial/t4.py
examples/tutorial/t5.py
examples/tutorial/t6.py
examples/tutorial/t7.py
examples/tutorial/t8.py
examples/tutorial/t9.py
examples/webenginewidgets/simplebrowser.py
examples/widgets/animation/animatedtiles/animatedtiles.py
examples/widgets/animation/appchooser/appchooser.py
examples/widgets/animation/easing/easing.py
examples/widgets/animation/states/states.py
examples/widgets/dialogs/classwizard/classwizard.py
examples/widgets/dialogs/extension.py
examples/widgets/dialogs/findfiles.py
examples/widgets/dialogs/standarddialogs.py
examples/widgets/dialogs/trivialwizard.py
examples/widgets/draganddrop/draggabletext/draggabletext.py
examples/widgets/effects/lighting.py
examples/widgets/graphicsview/anchorlayout.py
examples/widgets/graphicsview/collidingmice/collidingmice.py
examples/widgets/graphicsview/diagramscene/diagramscene.py
examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py
examples/widgets/graphicsview/elasticnodes.py
examples/widgets/itemviews/addressbook/adddialogwidget.py
examples/widgets/itemviews/addressbook/addressbook.py
examples/widgets/itemviews/addressbook/addresswidget.py
examples/widgets/itemviews/addressbook/newaddresstab.py
examples/widgets/itemviews/addressbook/tablemodel.py
examples/widgets/itemviews/basicsortfiltermodel.py
examples/widgets/itemviews/fetchmore.py
examples/widgets/itemviews/stardelegate/stardelegate.py
examples/widgets/itemviews/stardelegate/stareditor.py
examples/widgets/itemviews/stardelegate/starrating.py
examples/widgets/layouts/basiclayouts.py
examples/widgets/layouts/dynamiclayouts.py
examples/widgets/layouts/flowlayout.py
examples/widgets/mainwindows/application/application.py
examples/widgets/mainwindows/dockwidgets/dockwidgets.py
examples/widgets/mainwindows/mdi/mdi.py
examples/widgets/painting/basicdrawing/basicdrawing.py
examples/widgets/painting/concentriccircles.py
examples/widgets/richtext/orderform.py
examples/widgets/richtext/syntaxhighlighter.py
examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py
examples/widgets/richtext/textobject/textobject.py
examples/widgets/state-machine/eventtrans.py
examples/widgets/state-machine/factstates.py
examples/widgets/state-machine/pingpong.py
examples/widgets/state-machine/rogue.py
examples/widgets/state-machine/trafficlight.py
examples/widgets/state-machine/twowaybutton.py
examples/widgets/tutorials/addressbook/part1.py
examples/widgets/tutorials/addressbook/part2.py
examples/widgets/tutorials/addressbook/part3.py
examples/widgets/tutorials/addressbook/part4.py
examples/widgets/tutorials/addressbook/part5.py
examples/widgets/tutorials/addressbook/part6.py
examples/widgets/tutorials/addressbook/part7.py
examples/widgets/widgets/hellogl_openglwidget_legacy.py
examples/widgets/widgets/tetrix.py
examples/xml/dombookmarks/dombookmarks.py
examples/xmlpatterns/schema/schema.py
2 changes: 1 addition & 1 deletion examples/charts/memoryusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def getMemoryUsage():
command = line[0:23].strip()
if command.endswith('.exe'):
command = command[0:len(command) - 4]
memoryUsage = float(line[64:74].strip().replace(',', ''))
memoryUsage = float(line[64:74].strip().replace(',', '').replace('.', ''))
legend = ''
if memoryUsage > 10240:
legend = '{} {}M'.format(command, round(memoryUsage / 1024))
Expand Down
115 changes: 115 additions & 0 deletions examples/datavisualization/bars3d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/python

#############################################################################
##
## Copyright (C) 2017 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 QtDataVisualization example"""

import os
import sys
from PySide2.QtCore import QRect, QSize, QProcess, Qt
from PySide2.QtGui import QGuiApplication, QScreen, QWindow
from PySide2.QtWidgets import QApplication, QSizePolicy, QMainWindow, QWidget
from PySide2.QtDataVisualization import QtDataVisualization

def dataToBarDataRow(data):
return list(QtDataVisualization.QBarDataItem(d) for d in data)

def dataToBarDataArray(data):
return list(dataToBarDataRow(row) for row in data)

class MainWindow(QMainWindow):

def __init__(self):
super(MainWindow, self).__init__()

self.setWindowTitle('Qt DataVisualization 3D Bars')

self.bars = QtDataVisualization.Q3DBars()

self.columnAxis = QtDataVisualization.QCategory3DAxis()
self.columnAxis.setTitle('Columns')
self.columnAxis.setTitleVisible(True)
self.columnAxis.setLabels(['Column1', 'Column2'])
self.columnAxis.setLabelAutoRotation(30);

self.rowAxis = QtDataVisualization.QCategory3DAxis()
self.rowAxis.setTitle('Rows')
self.rowAxis.setTitleVisible(True)
self.rowAxis.setLabels(['Row1', 'Row2'])
self.rowAxis.setLabelAutoRotation(30);

self.valueAxis = QtDataVisualization.QValue3DAxis()
self.valueAxis.setTitle('Values')
self.valueAxis.setTitleVisible(True)
self.valueAxis.setRange(0, 5);

self.bars.setRowAxis(self.rowAxis)
self.bars.setColumnAxis(self.columnAxis)
self.bars.setValueAxis(self.valueAxis)

self.series = QtDataVisualization.QBar3DSeries()
self.arrayData = [[1, 2], [3, 4]]
self.series.dataProxy().addRows(dataToBarDataArray(self.arrayData))

self.bars.setPrimarySeries(self.series)

self.container = QWidget.createWindowContainer(self.bars)

if not self.bars.hasContext():
print("Couldn't initialize the OpenGL context.")
sys.exit(-1)

camera = self.bars.scene().activeCamera()
camera.setYRotation(22.5)

geometry = QGuiApplication.primaryScreen().geometry()
size = geometry.height() * 3 / 4
self.container.setMinimumSize(size, size)

self.container.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding);
self.container.setFocusPolicy(Qt.StrongFocus);
self.setCentralWidget(self.container)

if __name__ == '__main__':
app = QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit(app.exec_())
5 changes: 4 additions & 1 deletion examples/declarative/extending/chapter1-basics/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def setName(self, value):

view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
view.setSource(QUrl.fromLocalFile('app.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
5 changes: 4 additions & 1 deletion examples/declarative/extending/chapter2-methods/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def clearChart(self):

view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
view.setSource(QUrl.fromLocalFile('app.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
5 changes: 4 additions & 1 deletion examples/declarative/extending/chapter3-bindings/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def clearChart(self):

view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
view.setSource(QUrl.fromLocalFile('app.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def setPieSlice(self, value):

view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
view.setSource(QUrl.fromLocalFile('app.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ def appendSlice(self, _slice):

view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
view.setSource(QUrl.fromLocalFile('app.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
7 changes: 5 additions & 2 deletions examples/declarative/scrolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

from __future__ import print_function

import os
import sys
from PySide2.QtCore import QUrl
from PySide2.QtGui import QGuiApplication
Expand All @@ -60,8 +61,10 @@
ctxt = view.rootContext()
ctxt.setContextProperty("myModel", dataList)

url = QUrl('view.qml')
view.setSource(url)
qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()

app.exec_()
Expand Down
6 changes: 5 additions & 1 deletion examples/declarative/signals/pytoqml1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

from __future__ import print_function

import os
import sys
from PySide2.QtCore import QTimer, QUrl
from PySide2.QtGui import QGuiApplication
Expand All @@ -55,7 +56,10 @@
timer.start(2000)

view = QQuickView()
view.setSource(QUrl('view.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
root = view.rootObject()

timer.timeout.connect(root.updateRotater)
Expand Down
6 changes: 5 additions & 1 deletion examples/declarative/signals/qmltopy1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

from __future__ import print_function

import os
import sys
from PySide2.QtCore import QObject, QUrl, Slot
from PySide2.QtGui import QGuiApplication
Expand Down Expand Up @@ -76,7 +77,10 @@ def outputFloat(self, x):
context = view.rootContext()
context.setContextProperty("con", con)

view.setSource(QUrl('view.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
6 changes: 5 additions & 1 deletion examples/declarative/signals/qmltopy2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

from __future__ import print_function

import os
import sys
from PySide2.QtCore import QObject, QUrl, Slot
from PySide2.QtGui import QGuiApplication
Expand All @@ -68,7 +69,10 @@ def val(self):
context = view.rootContext()
context.setContextProperty("rotatevalue", rotatevalue)

view.setSource(QUrl('view.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)
view.show()
res = app.exec_()
# Deleting the view before it goes out of scope is required to make sure all child QML instances
Expand Down
6 changes: 5 additions & 1 deletion examples/declarative/signals/qmltopy3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

from __future__ import print_function

import os
import sys
from PySide2.QtCore import QObject, QUrl
from PySide2.QtGui import QGuiApplication
Expand All @@ -54,7 +55,10 @@ def sayThis(s):
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
view = QQuickView()
view.setSource(QUrl('view.qml'))
qmlFile = os.path.join(os.path.dirname(__file__), 'view.qml')
view.setSource(QUrl.fromLocalFile(qmlFile))
if view.status() == QQuickView.Error:
sys.exit(-1)

root = view.rootObject()
root.textRotationChanged.connect(sayThis)
Expand Down
Loading

0 comments on commit bd0c77f

Please sign in to comment.