aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-05-06 23:16:10 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-05-08 15:07:41 +0200
commita3c9fb78cb33c29d49dbe83d0525c5935e77beed (patch)
treeb01c7f709c3c48326b8d11503e5da4478b3666af /examples
parent93563959cd9e64087599a829fc7d6afe22d3b487 (diff)
parentcef5e9d385d0cf78e43e8ea41edf253b78f0ca13 (diff)
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/customitems/painteditem/textballoon.cpp15
-rw-r--r--examples/quick/demos/demos.pro6
-rw-r--r--examples/quick/demos/photoviewer/main.cpp4
-rw-r--r--examples/quick/demos/photoviewer/photoviewer.pro2
-rw-r--r--examples/quick/scenegraph/customgeometry/beziercurve.cpp6
5 files changed, 16 insertions, 17 deletions
diff --git a/examples/quick/customitems/painteditem/textballoon.cpp b/examples/quick/customitems/painteditem/textballoon.cpp
index 1713cc762f..bd8248e65e 100644
--- a/examples/quick/customitems/painteditem/textballoon.cpp
+++ b/examples/quick/customitems/painteditem/textballoon.cpp
@@ -67,23 +67,24 @@ void TextBalloon::paint(QPainter *painter)
painter->setPen(Qt::NoPen);
painter->setRenderHint(QPainter::Antialiasing);
- painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height() - 10, 10, 10);
+ QSizeF itemSize = size();
+ painter->drawRoundedRect(0, 0, itemSize.width(), itemSize.height() - 10, 10, 10);
if (rightAligned)
{
const QPointF points[3] = {
- QPointF(boundingRect().width() - 10.0, boundingRect().height() - 10.0),
- QPointF(boundingRect().width() - 20.0, boundingRect().height()),
- QPointF(boundingRect().width() - 30.0, boundingRect().height() - 10.0),
+ QPointF(itemSize.width() - 10.0, itemSize.height() - 10.0),
+ QPointF(itemSize.width() - 20.0, itemSize.height()),
+ QPointF(itemSize.width() - 30.0, itemSize.height() - 10.0),
};
painter->drawConvexPolygon(points, 3);
}
else
{
const QPointF points[3] = {
- QPointF(10.0, boundingRect().height() - 10.0),
- QPointF(20.0, boundingRect().height()),
- QPointF(30.0, boundingRect().height() - 10.0),
+ QPointF(10.0, itemSize.height() - 10.0),
+ QPointF(20.0, itemSize.height()),
+ QPointF(30.0, itemSize.height() - 10.0),
};
painter->drawConvexPolygon(points, 3);
}
diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro
index 5a6fd52baf..0644b81a22 100644
--- a/examples/quick/demos/demos.pro
+++ b/examples/quick/demos/demos.pro
@@ -7,7 +7,5 @@ SUBDIRS = samegame \
photosurface \
stocqt
-qtHaveModule(xmlpatterns) {
- SUBDIRS += rssnews
- qtHaveModule(widgets): SUBDIRS += photoviewer
-}
+qtHaveModule(xmlpatterns): SUBDIRS += rssnews photoviewer
+
diff --git a/examples/quick/demos/photoviewer/main.cpp b/examples/quick/demos/photoviewer/main.cpp
index 172d14307e..a269a61dcb 100644
--- a/examples/quick/demos/photoviewer/main.cpp
+++ b/examples/quick/demos/photoviewer/main.cpp
@@ -48,14 +48,14 @@
**
****************************************************************************/
-#include <QApplication>
+#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QTranslator>
#include <QDebug>
int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
QTranslator qtTranslator;
qtTranslator.load("qml_" + QLocale::system().name(), ":/i18n/");
diff --git a/examples/quick/demos/photoviewer/photoviewer.pro b/examples/quick/demos/photoviewer/photoviewer.pro
index 4bfdb86f31..68e43e13f9 100644
--- a/examples/quick/demos/photoviewer/photoviewer.pro
+++ b/examples/quick/demos/photoviewer/photoviewer.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-QT += qml quick widgets xmlpatterns
+QT += qml quick xmlpatterns
SOURCES += main.cpp
diff --git a/examples/quick/scenegraph/customgeometry/beziercurve.cpp b/examples/quick/scenegraph/customgeometry/beziercurve.cpp
index ca3c6f524b..750ff6aa3b 100644
--- a/examples/quick/scenegraph/customgeometry/beziercurve.cpp
+++ b/examples/quick/scenegraph/customgeometry/beziercurve.cpp
@@ -152,7 +152,7 @@ QSGNode *BezierCurve::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
//! [7]
//! [8]
- QRectF bounds = boundingRect();
+ QSizeF itemSize = size();
QSGGeometry::Point2D *vertices = geometry->vertexDataAsPoint2D();
for (int i = 0; i < m_segmentCount; ++i) {
qreal t = i / qreal(m_segmentCount - 1);
@@ -163,8 +163,8 @@ QSGNode *BezierCurve::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+ 3 * invt * t * t * m_p3
+ t * t * t * m_p4;
- float x = bounds.x() + pos.x() * bounds.width();
- float y = bounds.y() + pos.y() * bounds.height();
+ float x = pos.x() * itemSize.width();
+ float y = pos.y() * itemSize.height();
vertices[i].set(x, y);
}