[PATCH] Configure toolbars from RMB switch to the current toolbar
David Faure
faure at kde.org
Wed Apr 28 19:47:25 BST 2004
On Wednesday 28 April 2004 20:35, Andras Mantia wrote:
> Hi,
>
> Here is the (1st version of the) patch to implement what I was talking
> about earlier today. I read the BC document and it is written there
> that introducing static member variables is possible, but I got linking
> errors in the kdeui if I made m_defaultToolbar a static member
> variable
That's because you forgot to instanciate it in kedittoolbar.cpp ...
> so now it is a (static) global one. I've tested with KMail
> and Konqueror and works fine (without recompiling the apps).
Static objects in libraries are a very bad idea (destruction order not defined, etc.).
This is about storing a const char* anyway (an object's name), not a QString.
How about a class-static "const char* s_toolbarName;"?
You *will* need to instanciate it in the .cpp file, with
const char* KEditToolbar::s_toolbarName = 0;
(e.g. somewhere at the top of the .cpp file)
Make sure you call setDefaultToolbar(0) at the end of the ktoolbar.cpp method,
so that we don't risk keeping a dangling pointer. Once the popupmenu is closed
we don't need this anymore, anyway.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list