summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-04-19 13:57:06 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-04-19 13:51:41 +0000
commit0a1c30c28c7ebaf034b7c61fb3e5308aa2c74258 (patch)
treef6507d96fb8cca86ffd6ed1ba89a85266ec6e306
parenta261818093dfa6f3c6bf83cccb3c1a068596c575 (diff)
Add profile ui toggling to widget example
the qml one has been updated before but there is no way to toggle the view from the widget example. Add this, especially because seeing the framerate for the widget is important - right now Q3DSWidget still suffers from being locked to ~30 FPS for some reason. Change-Id: I4beb6ecef2df74a5ca6ccd74fea1da4baf73712d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--examples/3dstudioruntime2/simplewidget/main.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/3dstudioruntime2/simplewidget/main.cpp b/examples/3dstudioruntime2/simplewidget/main.cpp
index d140232..34ed8ab 100644
--- a/examples/3dstudioruntime2/simplewidget/main.cpp
+++ b/examples/3dstudioruntime2/simplewidget/main.cpp
@@ -79,6 +79,7 @@ int main(int argc, char *argv[])
if (!msg.isEmpty())
QMessageBox::critical(&w, QLatin1String("Failed to load presentation"), msg, QLatin1String("Ok"));
});
+ w3DS->presentation()->setProfilingEnabled(true);
w3DS->presentation()->setSource(QUrl(QLatin1String("qrc:/barrel.uip")));
layout->addWidget(w3DS);
@@ -97,6 +98,11 @@ int main(int argc, char *argv[])
QPushButton *reloadBtn = new QPushButton(QLatin1String("Reload"));
QObject::connect(reloadBtn, &QPushButton::clicked, w3DS, [w3DS] { w3DS->presentation()->reload(); });
buttonLayout->addWidget(reloadBtn);
+ QPushButton *profBtn = new QPushButton(QLatin1String("Toggle profile UI"));
+ QObject::connect(profBtn, &QPushButton::clicked, w3DS, [w3DS] {
+ w3DS->presentation()->setProfileUiVisible(!w3DS->presentation()->isProfileUiVisible());
+ });
+ buttonLayout->addWidget(profBtn);
w.resize(1024, 768);
w.show();