forked from qt-creator/qt-creator
Qmlpuppet: Remove an explicit bool type for fitAndHideBox() function
Explicit return values in qml functions cause errors in some Qt versions, so remove the need for it. Change-Id: Idd3035b19b56c25e94bc846c3de8f7aa5381e1eb Reviewed-by: Artur Shepilko <artur.shepilko@nomadbyte.com> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
committed by
Miikka Heikkinen
parent
e245abec9e
commit
1522dc98c1
@@ -40,20 +40,15 @@ Item {
|
|||||||
selectionBox.targetNode = view3D.importScene;
|
selectionBox.targetNode = view3D.importScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fitAndHideBox() : bool
|
function fitAndHideBox()
|
||||||
{
|
{
|
||||||
cameraControl.focusObject(selectionBox.model, viewCamera.eulerRotation, true, true);
|
cameraControl.focusObject(selectionBox.model, viewCamera.eulerRotation, true, true);
|
||||||
if (cameraControl._zoomFactor < 0.1) {
|
if (cameraControl._zoomFactor < 0.1)
|
||||||
view3D.importScene.scale = view3D.importScene.scale.times(10);
|
view3D.importScene.scale = view3D.importScene.scale.times(10);
|
||||||
return false;
|
if (cameraControl._zoomFactor > 100)
|
||||||
}
|
|
||||||
if (cameraControl._zoomFactor > 100) {
|
|
||||||
view3D.importScene.scale = view3D.importScene.scale.times(0.1);
|
view3D.importScene.scale = view3D.importScene.scale.times(0.1);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectionBox.visible = false;
|
selectionBox.visible = false;
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
View3D {
|
View3D {
|
||||||
|
@@ -117,17 +117,16 @@ void IconRenderer::setupRender()
|
|||||||
// Render once to make sure scene is up to date before we set up the selection box
|
// Render once to make sure scene is up to date before we set up the selection box
|
||||||
render({});
|
render({});
|
||||||
QMetaObject::invokeMethod(containerItem, "setSceneToBox");
|
QMetaObject::invokeMethod(containerItem, "setSceneToBox");
|
||||||
bool success = false;
|
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
while (!success && tries < 10) {
|
while (tries < 10) {
|
||||||
++tries;
|
++tries;
|
||||||
render({});
|
render({});
|
||||||
QMetaObject::invokeMethod(containerItem, "fitAndHideBox",
|
QMetaObject::invokeMethod(containerItem, "fitAndHideBox");
|
||||||
Q_RETURN_ARG(bool, success));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(is3D)
|
Q_UNUSED(is3D)
|
||||||
|
Q_UNUSED(containerItem)
|
||||||
#endif
|
#endif
|
||||||
QFileInfo fi(m_filePath);
|
QFileInfo fi(m_filePath);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user