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

List:       kde-devel
Subject:    re: kpaint
From:       Michael Thaler <michael.thaler () ph ! tum ! de>
Date:       2003-09-09 8:52:56
[Download RAW message or body]

Hello,

I tried to create a kwidget-toolbar with the following code:

id=0;
    QButtonGroup *toolButtonGroup = new QButtonGroup( 0L );
    for ( Tool *t= tl.first(); t; t= tl.next() )
    {
      if ( !t->isSpecial() ) {	
	toolButtonGroup->setExclusive(true);
	QPushButton *toolButton=new QPushButton(this);
	toolButton->setToggleButton(true);
	toolButtonGroup->insert(toolButton);
	KWidgetAction *toolToolbarAction = new
KWidgetAction(toolButton,t->name(), 0, 0, 0, actionCollection(),
QCString().sprintf("tool_%d", id));
	
	mapper->setMapping( toolToolbarAction, id++ );
	connect( toolButton, SIGNAL( clicked() ),
		 mapper, SLOT( map() ) );
      }
     
    }

I just changed the class from KRadioAction to KWidgetAction, added the
buttonGroup and the buttons. Now, when I start kpaint, I get the
following error messages:

...
kpaint (kdegraphics): Tool::setLeftBrush()
kpaint (kdegraphics): Tool::setRightPen()
kpaint (kdegraphics): Tool::setRightBrush()
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: ERROR: KWidgetAction::plug: KWidgetAction must be plugged into
KToolBar.
kpaint: kpaint: clipboard has image: false
kpaint (kdegraphics): File New
kpaint (kdegraphics): Here we can implement a tool properties dialoge!
kpaint (kdegraphics):
...

I think that is because the QPushbuttons have to be child-widgets of
QToolBar.

I tried the following:

QPushButton *toolButton=new QPushButton(toolbar( 0L ));

But this does not work either. What am I doing wrong here?

My second problem is, that the signals do not work any longer. The
original code was: 

	mapper->setMapping( toolMenuAction, id++ );
	connect( toolMenuAction, SIGNAL( activated() ),
		 mapper, SLOT( map() ) );

here, toolMenuAction is a KRadioAction. Any ideas why my code does not
work?

Take care
Michael
-- 
We shall not cease from exploration, and the end of all our exploring 
will be to arrive where we started and know the place for the first time.

 
>> 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