[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: adding a menu to a KMainApplication
From:       David Faure <faure () kde ! org>
Date:       2008-01-07 9:43:06
Message-ID: 200801071043.06461.faure () kde ! org
[Download RAW message or body]

On Monday 26 November 2007, Lorenzo Bettini wrote:
> Will Stephenson wrote:
> > On Monday 26 November 2007, Lorenzo Bettini said:
> > <snip>
> > 
> > > but the menus added with menuBar()->insertItem are not shown at all...
> > > 
> > > am I doing something wrong?
> > 
> > This doesn't answer your question, but you really should use XMLGUI for 
> > setting up windows and toolbars like this.  You don't have to bother with the 
> > insertItem() tedium, just instantiate your actions and let the createGUI() 
> > call do the rest.  The following rather old but still generally good tutorial 
> > explains it:
> > 
> > http://developer.kde.org/documentation/tutorials/xmlui/preface.html
> > 
> 
> actually I'm still using KDE 3, and I'd like to avoid using the .rc 
> file, since you need to install the application even for testing and I'd 
> like to avoid this (am I right about installation?)

Yes, but there is a way to avoid the need for installing; see what \
                kdelibs/kdeui/tests/kwindowtest.cpp does:
kwindowtest.cpp:    KGlobal::dirs()->addResourceDir( "data", KDESRCDIR );

with this in CMakeLists.txt (done automatically for test programs) :
  set_target_properties(${_target_NAME} PROPERTIES COMPILE_FLAGS \
-DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}\\"") OK you said KDE3, well, then \
AM_CXXFLAGS += -DKDESRCDIR=$srcdir  or something like that; I already forgot all \
about automake; that's good for my mental health I suppose :)

About dynamic menus: one solution is <ActionList> see api docs for \
KXMLGUIFactory::plugActionList, another solution is a child xml gui client.

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
 
> > Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic