forked from qt-creator/qt-creator
Fix Edit View 3D on top of Some widgets issue
setting the main window as the parent of a widget makes it open above the Edit View 3D. Also other dialogs (open file dialog, options dialog, etc) open above the 3D View now. Task-number: QDS-1446 Change-Id: I6f6325d7b81eccb5aec3c07dfadc021a17dfd26b Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -197,15 +197,27 @@ MainWindow::MainWindow()
|
|||||||
this, &MainWindow::openDroppedFiles);
|
this, &MainWindow::openDroppedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit View 3D needs to know when the main windows's state or activation change
|
// Edit View 3D needs to know when the main window's state or activation change
|
||||||
void MainWindow::changeEvent(QEvent *event)
|
void MainWindow::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState());
|
emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState());
|
||||||
m_previousWindowStates = windowState();
|
m_previousWindowStates = windowState();
|
||||||
} else if (event->type() == QEvent::ActivationChange) {
|
} else if (event->type() == QEvent::ActivationChange) {
|
||||||
auto lastChild = qobject_cast<QWidget *>(children().last());
|
// check the last 3 children for a possible active window
|
||||||
bool hasPopup = lastChild && lastChild->isActiveWindow();
|
auto rIter = children().rbegin();
|
||||||
|
bool hasPopup = false;
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
if (rIter < children().rend()) {
|
||||||
|
auto child = qobject_cast<QWidget *>(*(rIter++));
|
||||||
|
if (child && child->isActiveWindow()) {
|
||||||
|
hasPopup = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup);
|
emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -195,7 +195,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
|||||||
&QmlDesignerPlugin::instance()->viewManager().designerActionManager();
|
&QmlDesignerPlugin::instance()->viewManager().designerActionManager();
|
||||||
|
|
||||||
auto handle3DModel = [](const QStringList &fileNames, const QString &defaultDir) -> bool {
|
auto handle3DModel = [](const QStringList &fileNames, const QString &defaultDir) -> bool {
|
||||||
auto importDlg = new ItemLibraryAssetImportDialog(fileNames, defaultDir);
|
auto importDlg = new ItemLibraryAssetImportDialog(fileNames, defaultDir, Core::ICore::mainWindow());
|
||||||
importDlg->show();
|
importDlg->show();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -505,7 +505,7 @@ void ItemLibraryWidget::addResources()
|
|||||||
static QString lastDir;
|
static QString lastDir;
|
||||||
const QString currentDir = lastDir.isEmpty() ? document->fileName().parentDir().toString() : lastDir;
|
const QString currentDir = lastDir.isEmpty() ? document->fileName().parentDir().toString() : lastDir;
|
||||||
|
|
||||||
const auto fileNames = QFileDialog::getOpenFileNames(this,
|
const auto fileNames = QFileDialog::getOpenFileNames(Core::ICore::mainWindow(),
|
||||||
tr("Add Resources"),
|
tr("Add Resources"),
|
||||||
currentDir,
|
currentDir,
|
||||||
filters.join(";;"));
|
filters.join(";;"));
|
||||||
|
Reference in New Issue
Block a user