On Monday 22 July 2013 21:43:35 Kevin Krammer wrote:
> On Monday, 2013-07-22, Pali Rohár wrote:
> > There is one problem with "New Message" and "Reply" action
> > menus in main toolbar. Kontact show only texts and no icons
> > for these buttons. It is because KDE api KActionCollection
> > accept only QAction. But these actions are QWidget(s).
> 
> I don't understand. The actions are widgets?
> 

This is current trojita code:

    QAction *m_editDraft = ...;
    QAction *composeMail = ...;
    QMenu *m_composeMenu;
    QToolButton *m_composeButton;
    QToolBar *m_mainToolbar;
    QAction *expunge = ...;

    m_composeMenu = new QMenu(tr("Compose Mail"), this);
    m_composeMenu->addAction(composeMail);
    m_composeMenu->addAction(m_editDraft);

    m_composeButton = new QToolButton(this);
    m_composeButton->setPopupMode(QToolButton::MenuButtonPopup);
    m_composeButton->setMenu(m_composeMenu);
    m_composeButton->setDefaultAction(composeMail);

    m_mainToolbar->addWidget(m_composeButton);
    m_mainToolbar->addAction(expunge);

I need to add widget m_composeButton to actionCollection(). 
QAction expunge working fine in actionCollection().

m_composeButton is buttoned menu for main toolbar. You can see it 
in trojita main toolbar as first button.

Better, if you can compile & run my kontact plugin. You will see 
where is problem.

> > Kevin, can you help me? How can I push QWidget to
> > KActionCollection, so it will appear in KDE application
> > menu? Or it is possible to set icon for (sub)menu in XML
> > .rc file?
> 
> I don't think the level of the action matters, it is always a
> KAction which is a QAction which can have an icon set.
> 
> Cheers,
> Kevin

-- 
Pali Rohár
[email protected]

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to