Some issues with the polyline and polygon tools

Michael Thaler michael.thaler at ph.tum.de
Sun Mar 20 08:24:45 CET 2005


On Saturday 19 March 2005 23:39, Boudewijn Rempt wrote:

> > Is it possible to have two icons for one tool?
>
> Sure, just create two actions.

I tried:

void KisToolPolygon::setup(KActionCollection *collection)
{
        //setup the polygon action
        m_action = static_cast<KRadioAction *>(collection -> action(name()));

 if (m_action == 0) {
  KShortcut shortcut(Qt::Key_Plus);
  shortcut.append(KShortcut(Qt::Key_F8));
  m_action = new KRadioAction(i18n("Tool &Polygon"),
         "polygon",
         shortcut,
         this,
         SLOT(activatePolygon()),
         collection,
         name());
  m_action -> setExclusiveGroup("tools");
  m_ownAction = true;
        }

        //setup the polyline action

        KShortcut shortcut(Qt::Key_Plus);
        shortcut.append(KShortcut(Qt::Key_F8));
        m_action = new KRadioAction(i18n("Tool &Polyline"),
                                        "polyline",
                                        shortcut,
                                        this,
                                        SLOT(activatePolyline()),
                                        collection,
                                        name());
        m_action -> setExclusiveGroup("tools");
        m_ownAction = true;
      

}

But that does not work. Why do we need the line
m_action = static_cast<KRadioAction *>(collection -> action(name())); ? What 
does it actually do? How can I set up two actions?

Greetings,
Michael


More information about the kimageshop mailing list