summaryrefslogtreecommitdiffstats
path: root/tests/manual/rendercapture-cpp/mycapture.h
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2017-02-17 13:47:30 +0100
committerKevin Ottens <kevin.ottens@kdab.com>2017-02-23 12:57:49 +0000
commita7942ff7260a213cdb3feb897173847742544f5b (patch)
tree200242898e5e2f68e0abd74b35bfc0e23f387e43 /tests/manual/rendercapture-cpp/mycapture.h
parentcd4aac77040dd5500fd8b9d80f700eb0234390f6 (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/rendercapture-cpp/mycapture.h')
-rw-r--r--tests/manual/rendercapture-cpp/mycapture.h26
1 files changed, 10 insertions, 16 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