diff -r 608f976aa7bb -r e2a80d9b5858 flagrowobj.cpp --- a/flagrowobj.cpp Tue Jun 06 14:58:11 2006 +0000 +++ b/flagrowobj.cpp Thu Jul 06 15:39:54 2006 +0000 @@ -1,5 +1,7 @@ #include "flagrowobj.h" +#include + ///////////////////////////////////////////////////////////////// // FlagRowObj ///////////////////////////////////////////////////////////////// @@ -232,15 +234,16 @@ } } +void FlagRowObj::setToolBar(QToolBar *tb) +{ + toolbar=tb; +} + void FlagRowObj::setEnabled (bool b) { - // If we have no parent, we are the default FlagRowObj - // and have QToolbarButtons - if (!parentRow) + if (toolbar) { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - fo->setEnabled (b); + toolbar->setEnabled (b); } } @@ -286,45 +289,13 @@ name=n; } -void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n) -{ - //Only make toolbar for the parentrow, not each row in branches - if (!parentRow) - { - // create bar and buttons - Q3ToolBar* tb = new Q3ToolBar( w); - tb->setLabel (n); - QAction *a; - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - { - a=new QAction ( -// FIXME was in QT3: fo->getToolTip(), - fo->getPixmap(), - fo->getName(), -// 0, - w -// fo->getName() - ); - a->setToggleAction(true); -// a->setTooltip (fo->getToolTip()); - // FIXME should not be enabled by default, later in updateToolbar - a->setEnabled(true); - a->addTo (tb); - fo->setButton (a); - connect(a, SIGNAL( activated() ), - w, SLOT( standardFlagChanged() ) ); - } - } else - qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows"); -} - void FlagRowObj::updateToolbar() { FlagObj *fo; if (parentRow) { // We are just a branch, not the toolbar default + // but state has to be copied from ourselves to parentrow! parentRow->deactivateAll(); // In parentRow activate all existing (==active) flags for (fo=flag.first();fo; fo=flag.next() ) @@ -333,8 +304,12 @@ } else { // We are the toolbar default - for (fo=flag.first();fo; fo=flag.next() ) - fo->updateButton(); + if (toolbar) + { + // Update state of actions in toolbar + for (fo=flag.first();fo; fo=flag.next() ) + fo->updateAction(); + } } }