KAction KToolBarPopupAction and slot

danigm danigm at gmail.com
Fri Nov 24 12:21:02 GMT 2006


I'm trying to add an icon, like "back", in konqueror's toolbar, and
for this I create a new KToolBarPopupAction and a new slot for it, in
konq_mainwindow.h:
void slotTrashTab();
...
KToolBarPopupAction *m_paTrashTab;
...

And in konq_mainwindow.cc I add this lines:

...
m_paTrashTab = new KToolBarPopupAction( KIcon("trashcan_full"),  i18n(
"trashTab" ), actionCollection(), "trashTab" );

connect( m_paTrashTab, SIGNAL( triggered( Qt::MouseButtons,
Qt::KeyboardModifiers) ), this, SLOT( slotTrashTab() ) );

connect( m_paTrashTab->menu(), SIGNAL( aboutToShow() ), this, SLOT(
slotBackAboutToShow() ) );

connect( m_paTrashTab->menu(), SIGNAL( activated( int ) ), this, SLOT(
slotBackActivated( int ) ) );
...
void KonqMainWindow::slotTrashTab(Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
{
    kDebug(1202) << "Boton de prueba" << endl;
}
...

And in konqueror.rc I add
<Action name="trashTab" />

Then when i run it, the button appear, but when i click on it, nothing
happens. But if y change the slot function by one implemented, like
slotBack(), it work ok.

I google for this, but I don't find nothing. Someone can help me, and
explain me the cause of this?

Thanks a lot, and good work.

-- 
Nunca consideres el estudio como un deber, sino como una oportunidad
para penetrar en el maravilloso mundo del saber.
     -- Albert Einstein. (1879-1955) Físico alemán.
---
danigm... mi tira -->http://www.linuxhispano.net/tira/index.php




More information about the kfm-devel mailing list