Some issues with the polyline and polygon tools

Michael Thaler michael.thaler at ph.tum.de
Sun Mar 20 10:20:03 CET 2005


On Sunday 20 March 2005 09:23, Boudewijn Rempt wrote:

> Make sure both actions are also in the .rc file; additionally, you
> need to create two seperation actions, like:

O.K., I forgot that. I added both actions to the .rc file now:

<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritatoolpolygon" version="1">


<ToolBar name="painting tools" position="left"><Text>Painting Tools</Text>
  <Action name="tool_polygon"/>
  <Action name="tool_polyline"/>
</ToolBar>


</kpartgui>

>
>          m_actionPolygon = static_cast<KRadioAction *>(collection ->
> action("polygon")); m_actionPolyline = static_cast<KRadioAction
> *>(collection -> action("polyline"));

Unfortunately that makes Krita crash when the tool is activated:

Original:

//setup the polygon action
        m_action = static_cast<KRadioAction *>(collection -> 
action("polygon"));

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

With this, Krita works fine. Modified version which uses m_actionPolygon 
instead of m_action:

       //setup the polygon action
        m_actionPolygon = static_cast<KRadioAction *>(collection -> 
action("polygon"));

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

This makes Krita crash. Probably the super class makes something with 
m_action?

>
> > 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?
>
> Hm... I'll look at this when I get back from Church -- need to go now!
>
> Boudewijn
> _______________________________________________
> kimageshop mailing list
> kimageshop at kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop


More information about the kimageshop mailing list