summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-05-04 16:34:14 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-05-07 06:27:00 +0000
commit201b976824faba8a7d56b636c7d5b147a1cb2888 (patch)
treef90289f71d445a814e248721a93abaff58428d8d /src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
parentbd2eb9b978804ff509498244e863b80b0e0851b0 (diff)
Fix issues with popup positioning
- Unified various showBrowser functions under CDialogs as showWidgetBrowser - Fixed showWidgetBrowser logic to correctly determine browser popup position in all screens - Fixed startup dialog position when editor is maximized and on a secondary screen - Removed a few superfluous global utility functions. Task-number: QT3DS-1545 Change-Id: Ia8c526d14d8b15b649600d71474f1ba29657c00e Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Janne Kangas <janne.kangas@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index f292416e..f8f6e41e 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -53,6 +53,7 @@
#include "ClientDataModelBridge.h"
#include "MainFrm.h"
#include "DataInputDlg.h"
+#include "Dialogs.h"
#include <QtCore/qtimer.h>
#include <QtQml/qqmlcontext.h>
@@ -367,7 +368,7 @@ QObject *InspectorControlView::showImageChooser(int handle, int instance, const
m_imageChooserView->setHandle(handle);
m_imageChooserView->setInstance(instance);
- showBrowser(m_imageChooserView, point);
+ CDialogs::showWidgetBrowser(this, m_imageChooserView, point);
return m_imageChooserView;
}
@@ -386,7 +387,7 @@ QObject *InspectorControlView::showFilesChooser(int handle, int instance, const
m_fileChooserView->setHandle(handle);
m_fileChooserView->setInstance(instance);
- showBrowser(m_fileChooserView, point);
+ CDialogs::showWidgetBrowser(this, m_fileChooserView, point);
return m_fileChooserView;
}
@@ -409,7 +410,7 @@ QObject *InspectorControlView::showMeshChooser(int handle, int instance, const Q
m_meshChooserView->setHandle(handle);
m_meshChooserView->setInstance(instance);
- showBrowser(m_meshChooserView, point);
+ CDialogs::showWidgetBrowser(this, m_meshChooserView, point);
return m_meshChooserView;
}
@@ -428,7 +429,7 @@ QObject *InspectorControlView::showTextureChooser(int handle, int instance, cons
m_textureChooserView->setHandle(handle);
m_textureChooserView->setInstance(instance);
- showBrowser(m_textureChooserView, point);
+ CDialogs::showWidgetBrowser(this, m_textureChooserView, point);
return m_textureChooserView;
}
@@ -469,7 +470,7 @@ QObject *InspectorControlView::showObjectReference(int handle, int instance, con
m_objectReferenceView->selectAndExpand(refInstance, instance);
}
- showBrowser(m_objectReferenceView, point);
+ CDialogs::showWidgetBrowser(this, m_objectReferenceView, point);
connect(m_objectReferenceView, &ObjectBrowserView::selectionChanged,
this, [this, doc, handle, instance] {
@@ -517,36 +518,11 @@ QObject *InspectorControlView::showDataInputChooser(int handle, int instance, co
setData(dataInputList,
m_inspectorControlModel->currentControllerValue(instance, handle),
handle, instance);
- showBrowser(m_dataInputChooserView, point);
+ CDialogs::showWidgetBrowser(this, m_dataInputChooserView, point);
return m_dataInputChooserView;
}
-void InspectorControlView::showBrowser(QQuickWidget *browser, const QPoint &point)
-{
- QSize popupSize = CStudioPreferences::browserPopupSize();
- browser->resize(popupSize);
-
- // Make sure the popup doesn't go outside the screen
- QSize screenSize = QApplication::desktop()->availableGeometry(
- QApplication::desktop()->screenNumber(this)).size();
- QPoint newPos = point - QPoint(popupSize.width(), popupSize.height());
- if (newPos.y() < 0)
- newPos.setY(0);
- if (newPos.x() + popupSize.width() > screenSize.width())
- newPos.setX(screenSize.width() - popupSize.width());
- else if (newPos.x() < 0)
- newPos.setX(0);
- browser->move(newPos);
-
- // Show asynchronously to avoid flashing blank window on first show
- QTimer::singleShot(0, this, [browser] {
- browser->show();
- browser->activateWindow();
- browser->setFocus();
- });
-}
-
bool InspectorControlView::toolTipsEnabled()
{
return CStudioPreferences::ShouldShowTooltips();