From 452a78d0ac4a1579733a8ab641be24c9b7c0dd96 Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Thu, 6 Apr 2017 21:53:40 +0200 Subject: examples: photoviewer needs widgets support Task-number: QTBUG-60014 Change-Id: I3f44e68427f3f2855fd030dfa3f02be066d6fce3 Reviewed-by: Simon Hausmann --- examples/quick/demos/demos.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/quick') diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro index 0644b81a22..5a6fd52baf 100644 --- a/examples/quick/demos/demos.pro +++ b/examples/quick/demos/demos.pro @@ -7,5 +7,7 @@ SUBDIRS = samegame \ photosurface \ stocqt -qtHaveModule(xmlpatterns): SUBDIRS += rssnews photoviewer - +qtHaveModule(xmlpatterns) { + SUBDIRS += rssnews + qtHaveModule(widgets): SUBDIRS += photoviewer +} -- cgit v1.2.3 From 495f8f12ec17ece5708407ef09ece89887ea73bc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 18 Apr 2017 11:00:17 +0200 Subject: photoviewer example: don't depend on widgets It was never necessary for this example. This reverts commit 452a78d0ac4a1579733a8ab641be24c9b7c0dd96. Task-number: QTBUG-60014 Change-Id: Ib3f30d1d5de21d567919aa650bf3334247d5f271 Reviewed-by: Simon Hausmann --- examples/quick/demos/demos.pro | 6 ++---- examples/quick/demos/photoviewer/main.cpp | 4 ++-- examples/quick/demos/photoviewer/photoviewer.pro | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'examples/quick') 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 +#include #include #include #include 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 -- cgit v1.2.3 From ac29d0811ee1d712aefd2468374354de948bebfd Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 14 Apr 2017 10:39:54 +0200 Subject: examples: Remove some unnecessary (and non-ideal) use of internal API boundingRect is not documented for public use, and there's no need to repeatedly call it either. Change-Id: I844c704da0c0e7a5e94b387c5ebe9b26dc6b59fe Reviewed-by: Gunnar Sletta --- examples/quick/customitems/painteditem/textballoon.cpp | 15 ++++++++------- examples/quick/scenegraph/customgeometry/beziercurve.cpp | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'examples/quick') 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/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); } -- cgit v1.2.3