diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2017-02-17 13:47:30 +0100 |
---|---|---|
committer | Kevin Ottens <kevin.ottens@kdab.com> | 2017-02-23 12:57:49 +0000 |
commit | a7942ff7260a213cdb3feb897173847742544f5b (patch) | |
tree | 200242898e5e2f68e0abd74b35bfc0e23f387e43 /tests/manual | |
parent | cd4aac77040dd5500fd8b9d80f700eb0234390f6 (diff) |
Clean up QRenderCapture(Reply) API
We don't need the captureId in the public API so deprecate the functions
which make it appear and create overloads with no such id when
appropriate. Only a pointer to a QRenderCaptureReply is needed to
represent a capture request.
Also the "isCompleted" parameter is unneeded on the signal since it is
always true anyway. If we'd want to do error management it would go via
a status flag property or similar.
Change-Id: I9571ece3e3f82f46db5b3993ccf035e770c9d55e
Task-Id: QTBUG-58877
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/rendercapture-cpp/mycapture.h | 26 | ||||
-rw-r--r-- | tests/manual/rendercapture-qml/CaptureScene.qml | 4 | ||||
-rw-r--r-- | tests/manual/rendercapture-qml/main.qml | 4 |
3 files changed, 14 insertions, 20 deletions
diff --git a/tests/manual/rendercapture-cpp/mycapture.h b/tests/manual/rendercapture-cpp/mycapture.h index 249561a1e..cfd4afd6c 100644 --- a/tests/manual/rendercapture-cpp/mycapture.h +++ b/tests/manual/rendercapture-cpp/mycapture.h @@ -63,28 +63,23 @@ public: , m_reply(nullptr) , m_imageLabel(imageLabel) , m_continuous(false) - , m_cid(1) { } public slots: - void onCompleted(bool isComplete) + void onCompleted() { - if (isComplete) { - QObject::disconnect(connection); + QObject::disconnect(connection); - m_imageLabel->setPixmap(QPixmap::fromImage(m_reply->image())); + m_imageLabel->setPixmap(QPixmap::fromImage(m_reply->image())); - ++m_cid; + m_reply->saveToFile("capture.bmp"); - m_reply->saveToFile("capture.bmp"); + delete m_reply; + m_reply = nullptr; - delete m_reply; - m_reply = nullptr; - - if (m_continuous) - capture(); - } + if (m_continuous) + capture(); } void setContinuous(bool continuos) @@ -94,8 +89,8 @@ public slots: void capture() { - m_reply = m_capture->requestCapture(m_cid); - connection = QObject::connect(m_reply, &Qt3DRender::QRenderCaptureReply::completeChanged, + m_reply = m_capture->requestCapture(); + connection = QObject::connect(m_reply, &Qt3DRender::QRenderCaptureReply::completed, this, &MyCapture::onCompleted); } @@ -105,7 +100,6 @@ private: QMetaObject::Connection connection; QLabel *m_imageLabel; bool m_continuous; - int m_cid; }; #endif diff --git a/tests/manual/rendercapture-qml/CaptureScene.qml b/tests/manual/rendercapture-qml/CaptureScene.qml index 2329e4730..ea355042a 100644 --- a/tests/manual/rendercapture-qml/CaptureScene.qml +++ b/tests/manual/rendercapture-qml/CaptureScene.qml @@ -57,9 +57,9 @@ import Qt3D.Extras 2.0 Entity { id: sceneRoot - function requestRenderCapture(cid) + function requestRenderCapture() { - return renderCapture.requestCapture(cid) + return renderCapture.requestCapture() } Camera { diff --git a/tests/manual/rendercapture-qml/main.qml b/tests/manual/rendercapture-qml/main.qml index 77e96d739..fdb2e3519 100644 --- a/tests/manual/rendercapture-qml/main.qml +++ b/tests/manual/rendercapture-qml/main.qml @@ -51,7 +51,7 @@ import QtQuick 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls 1.4 -import Qt3D.Render 2.1 +import Qt3D.Render 2.9 import QtQuick.Scene3D 2.0 Item { @@ -96,7 +96,7 @@ Item { function doRenderCapture() { - reply = scene.requestRenderCapture(cid) + reply = scene.requestRenderCapture() reply.completeChanged.connect(onRenderCaptureComplete) } |