summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-08-14 17:55:45 +0000
committerFlorian Jung <flo@windfisch.org>2011-08-14 17:55:45 +0000
commit6898f640d5a95ab9c175388f22c4c846b8dbe5ab (patch)
tree8deaa5dd3074fc69287825627290aa0d04091c60 /muse2
parent238b1b82799a26b73384bb9d712656c39a822a99 (diff)
fixed "subwins steal focus" bug
this can be seen as an incomplete POC again :) TODO: - save and restore toolbar positions - handle closing windows
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/app.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index c7636c12..74eda773 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -716,6 +716,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
// create the menu with new QMenu and add it afterwards.
// the menu's owner must be this and not this->menuBar()!
+
//-------------------------------------------------------------
// popup File
//-------------------------------------------------------------
@@ -2961,7 +2962,7 @@ void MusE::focusChanged(QWidget*, QWidget* now)
}
// ptr is either NULL, this or the pointer to a TopWin
- if (ptr==this)
+ /*if (ptr==this) FINDMICHJETZT
{
QMdiSubWindow* subwin=mdiArea->currentSubWindow();
if (subwin)
@@ -2975,15 +2976,17 @@ void MusE::focusChanged(QWidget*, QWidget* now)
}
else
ptr=NULL;
- }
-
- TopWin* win=dynamic_cast<TopWin*>(ptr);
-
- // now 'win' is either NULL or the pointer to the active TopWin
- if (win!=activeTopWin)
+ }*/
+ if (ptr!=this) // if the main win is selected, don't treat that as "none", but also don't handle it
{
- activeTopWin=win;
- emit activeTopWinChanged(activeTopWin);
+ TopWin* win=dynamic_cast<TopWin*>(ptr);
+
+ // now 'win' is either NULL or the pointer to the active TopWin
+ if (win!=activeTopWin)
+ {
+ activeTopWin=win;
+ emit activeTopWinChanged(activeTopWin);
+ }
}
}
@@ -3014,6 +3017,25 @@ void MusE::activeTopWinChangedSlot(TopWin* win)
{
if (debugMsg) printf("ACTIVE TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "<None>", win);
+ if ((win==NULL) || (win->isMdiWin()==false))
+ {
+ if (debugMsg) printf(" that's out of the MDI area\n");
+ menuBar()->setFocus(Qt::MenuBarFocusReason);
+ }
+ if (win && false) //FINDMICHJETZT
+ {
+ if (win->isMdiWin())
+ {
+ if (debugMsg) printf(" that's a mdiSubWin\n");
+ }
+ else
+ {
+ if (debugMsg) printf(" that's a free floating window\n");
+ mdiArea->setActiveSubWindow(NULL);
+ mdiArea->clearFocus();
+ }
+ }
+
if (win && (win->sharesToolsAndMenu()))
setCurrentMenuSharingTopwin(win);
}
@@ -3080,6 +3102,7 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win)
addToolBar(*it);
foreignToolbars.push_back(*it);
+ (*it)->show(); //FINDMICHJETZT
}
else
{