[PATCH] Configure toolbars from RMB switch to the current toolbar
David Faure
dfaure at klaralvdalens-datakonsult.se
Wed Apr 28 20:57:41 BST 2004
On Wednesday 28 April 2004 21:43, Andras Mantia wrote:
> The current version deals with the case when the object name (eg.
> mainToolBar) or the toolbar label (Main Toolbar) is passed
The code in KEditToolbarWidget, yes, but that's not necessary in the static var,
that one is only used for a QObject name.
> so having a QString is better.
No, see below.
> This cannot be done in ktoolbar.cpp (in the slotContextHide), as that
> one is called before the edit toolbar dialog is initialized, this is
> why the variable is reset to an empty string in KEditToolbar::init().
OK.
> The second version of the patch with the static member variable is
> attached.
As I said, static objects in libraries are a big no no.
We've had enough crash due to them.
I still strongly suggest a static const char* (initialized and reset to 0).
The code in the widget can compare its member var to labels if it wants,
(for the people using the widget's ctor directly), that's not a problem.
Of course this is quite a hack - a hack which would break as soon as we try
moving KEditToolbar to another lib like kio or kutils, since at that point KToolbar
wouldn't be able to set the static var.... I think we'll have to redo this feature
for KDE 4.
--
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions
More information about the kde-core-devel
mailing list