Integrating QExtMDI's window menu in a KAction based app
Roland Krause
rokrau at yahoo.com
Wed Feb 20 16:26:04 UTC 2002
Falk,
it was late yesterday so I overlooked a "minor detail". If I just plow
the existing QPopupMenu pointer under, QextMdiMainFrm's destructor will
still try to delete it and this results in a crash. So we do need to do
one thing now and one thing later.
We need to make a method, lets call it,
void
QextMdiMainFrm::integrateWindowMenu(KPopupMenu * const _pWindowMenu)
{
if (! _pWindowMenu) return;
// set a flag that we do not own the "Window" QPopupMenu
m_ownWindowMenuPtr = false;
// delete old pointer to the "Window" QPopupMenu
delete m_pWindowMenu;
// set the new pointer
m_pWindowMenu = _pWindowMenu;
// make the connection
m_pWindowMenu->setCheckable( TRUE);
QObject::connect( m_pWindowMenu, SIGNAL(aboutToShow()),
this, SLOT(fillWindowMenu()) );
}
and then change the constructor and destructor accordingly so that the
memory to the m_pWindowMenu isnt freed if we dont own it.
if (m_ownWindowMenu) delete m_pWindowMenu;
I see that you want to change QextMdiMainFrm to use KActions, that
would make some sense but the integration problem remains the same.
That is because for automatic GUI merging you have to derive from
KXMLGUIClient, which you dont want to do. You can still use KActions
and they'd even have some advantages for QextMdiMainFrm (e.g.
consistent behavior of KeyAccel and toolbar integration) but again
there is no autoatic merging until you are a KXMLGUIClient.
Anyway, Falk, if you could/would make the above changes, I would
certainly much appreciate it. I will fix group enabling/disabling of
the KActions tonight and revamp the toolbars and accelerators during
the rest of this week.
This is slowly taking up shape. I believe I will be able to use the
first gideon part by next week already. I've looked into a few and I
believe the Tool part is usable although it doesnt have all the
features we have currently, but that's unfortunately true for most of
gideon.
Gotta make breakfast now,
let me know what you think.
land
> ATTACHMENT part 3.2 message/rfc822
> Date: Tue, 19 Feb 2002 22:21:23 -0800 (PST)
> From: Roland Krause <rokrau at yahoo.com>
> Subject: Re: Integrating QExtMDI's window menu in a KAction based app
> To: kdevelop-devel at kdevelop.org
> CC: gigafalk at yahoo.com
> Reply-to: kdevelop-devel at kdevelop.org
>
> Falk, I've finally figured it out.
>
> The merging can be done quite easily as follows.
>
> I create an entry for the Menu as an Action but not as a Menu in
> kdevelopui.rc . I.e.
>
> ...
> </Menu>
> <Action name="window_menu" />
> <Menu name="bookmarks">
> ...
>
> Then I create a KActionMenu for this Action and retrieve the
> KPopupMenu
> pointer which gets assigned to QextMdiMainFrm::m_pWindowMenu .
> Following, some attributes for the menu have to be set and the object
> SIGNAL/SLOTS have to be reconnected.
>
> Now Falk, is there a way to add a method to QextMdiMainFrm that
> encapsulates the assignment and takes care of freeing the memory of
> the
> original pointer. Allthough I believe that is not strictly necessary,
> I
> wouldnt mind encapsulating this stuff a bit better.
>
> Roland
> PS: with this the entire KDevelop menu is now taken care of via
> KActions. I'll have to do a bit work on defining "States" and getting
> a
> patch done for KXMLGUIClient but otherwise this is working great.
>
>
>
>
> >
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com
>
>
> ATTACHMENT part 3.3 message/rfc822
> Date: Wed, 20 Feb 2002 08:58:31 +0100
> From: "F at lk Brettschneider" <gigafalk at yahoo.com>
> Organization: FBI (Falk Brettschneider International)
> To: kdevelop-devel at kdevelop.org
> Subject: Re: Integrating QExtMDI's window menu in a KAction based app
> Reply-to: kdevelop-devel at kdevelop.org
>
> Roland Krause wrote:
> >
> > Falk, I've finally figured it out.
> Hey cool! Once I struggled with those dynamic KActions but gave up
> because of de2eng("räudige") documentation for that.
>
> > Now Falk, is there a way to add a method to QextMdiMainFrm that
> > encapsulates the assignment and takes care of freeing the memory of
> the
> > original pointer.
> QextMdiMainFrm::fillWindowMenu() is the one you're looking for.
> The mechanism is that everytime you click the menu entry "Window" the
> menu is cleared and newly build up because we simply must be sure the
> entries for the opened windows and the MDI mode state and so on are
> synchronized with the reality. That's why the QextMdiMainFrm
> constructor
> connects this:
> QObject::connect( m_pWindowMenu, SIGNAL(aboutToShow()), this,
> SLOT(fillWindowMenu()) );
> Roland, I'd like the idea to take KActions because it's a new step
> for
> getting QextMDI a real KDE base library. So I think having a "#ifndef
> NO_KDE2 ... #endif" paragraph in fillWindowMenu() is the right way to
> go.
> Note also that every entry for an open view is connected to
> QextMdiChildView::slot_clickedInWindowMenu(). That is for the view
> activation. But shouldn't be a problem with KAction....
>
>
> > Roland
> > PS: with this the entire KDevelop menu is now taken care of via
> > KActions.
> Great. I know it's a lot of work...
>
> Ciao,F at lk
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
> ATTACHMENT part 3.4 message/rfc822
> Date: Wed, 20 Feb 2002 11:47:00 +0100
> From: "F at lk Brettschneider" <gigafalk at yahoo.com>
> Organization: FBI (Falk Brettschneider International)
> To: kdevelop-devel at kdevelop.org
> Subject: TODO list online now
> Reply-to: kdevelop-devel at kdevelop.org
>
> Hi,
> I've updated www.kdevelop.org again.
> 12:O5 MET the TODO list will be online.
> I filled it with entries as far as I could remember. Please, tell me
> what is wrong, missing or to be changed.
>
> Cheers,F at lk
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
>
> > _______________________________________________
> Kdevelop-devel mailing list
> Kdevelop-devel at barney.cs.uni-potsdam.de
> http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com
More information about the KDevelop-devel
mailing list