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

List:       kde-kimageshop
Subject:    Re: Some issues with the polyline and polygon tools
From:       Michael Thaler <michael.thaler () ph ! tum ! de>
Date:       2005-03-20 9:20:03
Message-ID: 200503201020.03655.michael.thaler () physik ! tu-muenchen ! de
[Download RAW message or body]

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@kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic