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);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (event->type() == QEvent::WindowStateChange) {
|
||||
emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState());
|
||||
m_previousWindowStates = windowState();
|
||||
} else if (event->type() == QEvent::ActivationChange) {
|
||||
auto lastChild = qobject_cast<QWidget *>(children().last());
|
||||
bool hasPopup = lastChild && lastChild->isActiveWindow();
|
||||
// check the last 3 children for a possible active window
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user