Gideon problems and cosmetic patches

Jens Zurheide jens.zurheide at gmx.de
Sat Mar 22 09:53:04 UTC 2003


Hi!

>Jens Zurheide wrote:
>>>----- Original Message -----
>
From: "Jens Zurheide" <jens.zurheide at gmx.de>
>
>>>>One major problem I had is that the build menu entry of the main menu
>>>> is
>>>
>>>not
>>>
>>>>available for the "Childframe mode"
>>>
>>>Strange, it doesn't happen here (Childframe mode too). Please, check if
>>> it helps to comment out the code line with the removing of the menuitem
>>> from menuBar() in src/mainwindow.cpp.
>>
>>Ah... Now that I have figured out what causes the problem I understand
>> this paragraph.
>>
>>Yes, commenting out the line (around 255, committed between March 7th and
>>March 9th) solves the problem here.
>
>Hmm... the point is that I don't know how to replace the old Window menu
>(that was automatically created by the KParts .rc file mechanism) with
>our new one which is made manually. QMenuBar doesn't seem to provide the
>necessary functionality. So I hard-coded a remove at a certain index
>(IIRC count() - 4) and inserted the new one at the same position. Do you
>know a better approach that works in all cases?

Are you looking for something like this? The menu with the name &Window is 
removed independently of the position it is found and inserted in front of 
the Tools menu.

Index: mainwindow.cpp
===================================================================
RCS file: /home2/webcvs/mirror/kdevelop/src/mainwindow.cpp,v
retrieving revision 1.17
diff -3 -w -u -p -r1.17 mainwindow.cpp
--- mainwindow.cpp      11 Mar 2003 16:33:29 -0000      1.17
+++ mainwindow.cpp      22 Mar 2003 08:57:27 -0000
@@ -254,7 +254,11 @@ void MainWindow::init()
   createGUI(0);

   if (!isFakingSDIApplication()) {
-    menuBar()->removeItem( menuBar()->idAt(menuBar()->count()-4));
+    for ( int idx = 0; idx < static_cast<int>(menuBar()->count()); idx++ )
+    {
+      if ( menuBar()->text( idx ) == i18n("&Window") )
+        menuBar()->removeItem(menuBar()->idAt(idx));
+    }
     menuBar()->insertItem( i18n("&Window"), windowMenu(), -1, 
menuBar()->count()-1);
   }

----------------------------------------------------------------------
Two things: the static_cast<>() can be omitted if you don't intend to lint 
the project (otherwise signed <--> unsigned mixing warnings drive you 
nuts). 
The second thing I noticed is that the Window menu is not present in the 
menuBar() when this function is called initially. The good news is that it 
does not remove the Build menu in this case ;-).

Ciao,
Jens





More information about the KDevelop-devel mailing list