mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-21 10:47:16 +01:00
see #1998 : closing editor panel when user closes project panel, it seems gui crashes on mac only if editor panel is open at the time when user coses project panel
This commit is contained in:
parent
2d2267222b
commit
67c486194a
@ -1321,16 +1321,20 @@ bool FWWindow::event(QEvent *event)
|
||||
ev->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
case CLOSE_EDITOR_PANEL_EVENT:
|
||||
{
|
||||
hideEditor();
|
||||
ev->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// dispatch event to all projectpanel windows
|
||||
foreach(QMdiSubWindow* sw, m_mainWindow->m_space->subWindowList())
|
||||
QCoreApplication::sendEvent(sw->widget(), event);
|
||||
|
||||
// QList<QMdiSubWindow*> subWindowList = m_mainWindow->m_space->subWindowList();
|
||||
// for (int i = 0 ; i < subWindowList.size(); i++)
|
||||
// QCoreApplication::sendEvent(subWindowList[i]->widget(), event);
|
||||
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -76,6 +76,10 @@ void FWWindow::editorPanelTabChanged(int idx)
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* there are too many functions that open, close and hide editor panel.
|
||||
* TODO: need to get rid of redundant ones
|
||||
*/
|
||||
void FWWindow::showEditor()
|
||||
{
|
||||
m_mainWindow->objectEditorStack->setCurrentIndex(oe->getCurrentDialogIndex());
|
||||
@ -93,6 +97,15 @@ void FWWindow::closeEditor()
|
||||
m_mainWindow->editorDockWidget->close(); // editor
|
||||
}
|
||||
|
||||
void FWWindow::closeEditorPanel()
|
||||
{
|
||||
m_mainWindow->editorDockWidget->hide(); // editor
|
||||
}
|
||||
|
||||
void FWWindow::openEditorPanel()
|
||||
{
|
||||
}
|
||||
|
||||
void FWWindow::openEditor(FWObject *obj)
|
||||
{
|
||||
attachEditorToProjectPanel(activeProject());
|
||||
@ -256,15 +269,6 @@ ObjectEditor::OptType FWWindow::getOpenedOptEditor()
|
||||
return oe->getOpenedOpt();
|
||||
}
|
||||
|
||||
void FWWindow::closeEditorPanel()
|
||||
{
|
||||
m_mainWindow->editorDockWidget->hide(); // editor
|
||||
}
|
||||
|
||||
void FWWindow::openEditorPanel()
|
||||
{
|
||||
}
|
||||
|
||||
void FWWindow::findObject(FWObject *o)
|
||||
{
|
||||
if (activeProject())
|
||||
|
||||
@ -1058,11 +1058,6 @@ void ProjectPanel::hideEvent(QHideEvent *ev)
|
||||
if (fwbdebug) qDebug() << "ProjectPanel::hideEvent " << this
|
||||
<< "title " << mdiWindow->windowTitle();
|
||||
|
||||
disconnect(m_panel->treeDockWidget, SIGNAL(topLevelChanged(bool)),
|
||||
this, SLOT(topLevelChangedForTreePanel(bool)));
|
||||
disconnect(m_panel->treeDockWidget, SIGNAL(visibilityChanged(bool)),
|
||||
this, SLOT(visibilityChangedForTreePanel(bool)));
|
||||
|
||||
QWidget::hideEvent(ev);
|
||||
}
|
||||
|
||||
@ -1077,11 +1072,18 @@ void ProjectPanel::closeEvent(QCloseEvent * ev)
|
||||
return;
|
||||
}
|
||||
|
||||
disconnect(m_panel->treeDockWidget, SIGNAL(topLevelChanged(bool)),
|
||||
this, SLOT(topLevelChangedForTreePanel(bool)));
|
||||
disconnect(m_panel->treeDockWidget, SIGNAL(visibilityChanged(bool)),
|
||||
this, SLOT(visibilityChangedForTreePanel(bool)));
|
||||
|
||||
saveState();
|
||||
fileClose();
|
||||
|
||||
mw->updateWindowTitle();
|
||||
|
||||
QCoreApplication::postEvent(mw, new closeEditorPanelEvent());
|
||||
|
||||
QTimer::singleShot( 0, mw, SLOT(projectWindowClosed()) );
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,8 @@ enum EVENT_CODES {
|
||||
OPEN_LIBRARY_FOR_OBJECT_EVENT,
|
||||
UPDATE_SUBWINDOW_TITLES_EVENT,
|
||||
UPDATE_GUI_STATE_EVENT,
|
||||
EXPAND_OBJECT_IN_TREE
|
||||
EXPAND_OBJECT_IN_TREE,
|
||||
CLOSE_EDITOR_PANEL_EVENT ,
|
||||
};
|
||||
|
||||
|
||||
@ -373,7 +374,6 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
class expandObjectInTreeEvent : public fwbUpdateEvent {
|
||||
public:
|
||||
int parent_id;
|
||||
@ -384,4 +384,13 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
class closeEditorPanelEvent : public fwbUpdateEvent {
|
||||
public:
|
||||
closeEditorPanelEvent() :
|
||||
fwbUpdateEvent("", -1,
|
||||
QEvent::Type(QEvent::User + CLOSE_EDITOR_PANEL_EVENT),
|
||||
"closeEditorPanelEvent")
|
||||
{}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user