summaryrefslogtreecommitdiffstats
path: root/tests/manual/rendercapture-cpp/mycapture.h
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-05-24 12:09:44 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-05-24 12:10:02 +0100
commit77d294db076dac19e8b549b445ffede9f7260c84 (patch)
tree828ee7a6862ec5c0bd24f97cb540625a2c647376 /tests/manual/rendercapture-cpp/mycapture.h
parent59f8fec8a41606b3185fe3a4e276978e3e1ed5ef (diff)
parent939b9b4b7591e8a421cf048a0a84ed3e75d81d21 (diff)
Merge branch 'dev' into wip/animationwip/animation
Diffstat (limited to 'tests/manual/rendercapture-cpp/mycapture.h')
-rw-r--r--tests/manual/rendercapture-cpp/mycapture.h32
1 files changed, 14 insertions, 18 deletions
diff --git a/tests/manual/rendercapture-cpp/mycapture.h b/tests/manual/rendercapture-cpp/mycapture.h
index 803ef7336..fea1abe46 100644
--- a/tests/manual/rendercapture-cpp/mycapture.h
+++ b/tests/manual/rendercapture-cpp/mycapture.h
@@ -60,31 +60,26 @@ class MyCapture : public QObject
public:
MyCapture(Qt3DRender::QRenderCapture* capture, QLabel *imageLabel)
: m_capture(capture)
- , m_cid(1)
- , m_imageLabel(imageLabel)
, m_reply(nullptr)
+ , m_imageLabel(imageLabel)
, m_continuous(false)
{
}
public slots:
- void onCompleted(bool isComplete)
+ void onCompleted()
{
- if (isComplete) {
- QObject::disconnect(connection);
-
- m_imageLabel->setPixmap(QPixmap::fromImage(m_reply->image()));
+ QObject::disconnect(connection);
- ++m_cid;
+ m_imageLabel->setPixmap(QPixmap::fromImage(m_reply->image()));
- m_reply->saveToFile("capture.bmp");
+ m_reply->saveImage("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,9 +89,11 @@ public slots:
void capture()
{
- m_reply = m_capture->requestCapture(m_cid);
- connection = QObject::connect(m_reply, &Qt3DRender::QRenderCaptureReply::completeChanged,
- this, &MyCapture::onCompleted);
+ if (!m_reply) {
+ m_reply = m_capture->requestCapture();
+ connection = QObject::connect(m_reply, &Qt3DRender::QRenderCaptureReply::completed,
+ this, &MyCapture::onCompleted);
+ }
}
private:
@@ -105,7 +102,6 @@ private:
QMetaObject::Connection connection;
QLabel *m_imageLabel;
bool m_continuous;
- int m_cid;
};
#endif