From 6ade5518e91bcbeb76fdd89e32a8cec812aef35e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 26 Mar 2018 13:29:51 +0200 Subject: Add API for toggling profile UI and disable the implicit toggles In the viewer profiling is enabled by default and the built-in toggles (F10, backtick, double double click) or the menu item (when using widgets) can be used to bring up the UI. For applications none of these is ideal. Instead, provide a Q3DSPresentation property that can be used to toggle the UI. Therefore, an application will typically do profilingEnabled: true on its Presentation and then set profileUiVisible to true when it wants to. This way we are not tied to the sometimes not ideal keyboard and mouse shortcuts in real applications. Rename Q3DSEngine::profileUiEnabled to autoToggleProfileUi because that's what it really is. It merely enables or disables the built-in keyboard and mouse shortcuts for toggling, nothing more. Change-Id: If49ed7bc2575b7e81c2f6101dba307a639c3c011 Reviewed-by: Andy Nichols --- examples/3dstudioruntime2/simpleqml/main.cpp | 2 +- examples/3dstudioruntime2/simpleqml/main.qml | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/3dstudioruntime2/simpleqml/main.cpp b/examples/3dstudioruntime2/simpleqml/main.cpp index 44ac32b..897b59a 100644 --- a/examples/3dstudioruntime2/simpleqml/main.cpp +++ b/examples/3dstudioruntime2/simpleqml/main.cpp @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) viewer.setTitle(QStringLiteral("Qt 3D Studio Example")); viewer.setResizeMode(QQuickView::SizeRootObjectToView); - viewer.resize(1024, 768); + viewer.resize(1280, 720); viewer.show(); return app.exec(); diff --git a/examples/3dstudioruntime2/simpleqml/main.qml b/examples/3dstudioruntime2/simpleqml/main.qml index 67e043d..bb2782f 100644 --- a/examples/3dstudioruntime2/simpleqml/main.qml +++ b/examples/3dstudioruntime2/simpleqml/main.qml @@ -72,6 +72,7 @@ Rectangle { id: s3dpres source: "qrc:/presentation/barrel.uip" profilingEnabled: true + profileUiScale: profUiScale.value / 100 onCustomSignalEmitted: customSignalName.text = Date.now() + ": " + name onSlideEntered: slideEnter.text = "Entered slide " + name + "(index " + index + ") on " + elementPath onSlideExited: slideExit.text = "Exited slide " + name + "(index " + index + ") on " + elementPath @@ -155,9 +156,6 @@ Rectangle { } Button { text: "Fire event" - // Here we could open a Dialog to specify a target object and event - // name but creating a working dialog with Quick Controls 2 is way - // beyond my modest skills, apparently. onClicked: s3dpres.fireEvent("Scene.Layer.Camera", "customCameraEvent") // in actionevent.uip this will change the sphere's color focusPolicy: Qt.NoFocus } @@ -211,6 +209,25 @@ Rectangle { focusPolicy: Qt.NoFocus } + Button { + id: profTogBtn + text: "Toggle profile UI" + anchors.right: parent.right + anchors.bottom: parent.bottom + focusPolicy: Qt.NoFocus + onClicked: s3dpres.profileUiVisible = !s3dpres.profileUiVisible + } + Slider { + id: profUiScale + width: profTogBtn.width + anchors.right: profTogBtn.left + anchors.bottom: parent.bottom + from: 50 + to: 400 + value: 100 + focusPolicy: Qt.NoFocus + } + FileDialog { id: openDialog fileMode: FileDialog.OpenFile -- cgit v1.2.3