KToggleToolBarAction?

John Firebaugh jfirebaugh at kde.org
Thu Apr 4 06:33:31 BST 2002


On Wednesday 03 April 2002 5:21, John Firebaugh wrote:
> It seems to me that KXMLGUIBuilder should ask the main window for the
> toolbar, not create it itself. Anyone familiar with this code know for
> sure?

Something like this, perhaps:

Index: kxmlguibuilder.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kxmlguibuilder.cpp,v
retrieving revision 1.54
diff -u -3 -p -r1.54 kxmlguibuilder.cpp
--- kxmlguibuilder.cpp  2002/04/04 03:49:18     1.54
+++ kxmlguibuilder.cpp  2002/04/04 05:32:33
@@ -215,7 +215,13 @@ QWidget *KXMLGUIBuilder::createContainer
   {
     bool honor = (element.attribute( d->attrName ) == "mainToolBar");

-    KToolBar *bar = new KToolBar( d->m_widget, element.attribute( d->attrName 
).utf8(), honor, false );
+    QCString name = element.attribute( d->attrName ).utf8();
+
+    KToolBar *bar = static_cast<KToolBar*>(d->m_widget->child( name, 
"KToolBar" ));
+    if( !bar )
+    {
+       bar = new KToolBar( d->m_widget, name, honor, false );
+    }

     if ( d->m_widget->inherits( "KMainWindow" ) )
     {





More information about the kde-core-devel mailing list