[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Dynamic menus and shortcuts
From: Muhammad Jibran <mjibran () gmail ! com>
Date: 2004-08-31 11:40:58
Message-ID: e4c3339a04083104403f22103 () mail ! gmail ! com
[Download RAW message or body]
Well check this out.
// creating a menu
QPopupMenu *m_fileMenu = new QPopupMenu();
// creating a menu item
KAction *m_fileNew = new KAction(i18n("&New..."),
KShortcut("Insert"), this, SLOT(slotFileNew()), actionCollection(),
"file_new");
m_fileNew->setStatusText(i18n("Create a new document"));
m_fileNew->setIcon("filenew");
// now pluging it to menu
m_fileNew->plug( m_fileMenu );
QMenuBar *m_menuBar = new QMenuBar(this,"");
m_menuBar->insertItem(tr("&File"), m_fileMenu);
// and if you want to make available it to toolbar() then
m_fileNew->plug( toolBar() );
On Tue, 31 Aug 2004 13:24:12 +0200, Stanislav Visnovsky
<visnovsky@kde.org> wrote:
> Dňa Utorok 31 August 2004 12:19 Kevin Krammer napísal:
> > On Tuesday 31 August 2004 10:14, Stanislav Visnovsky wrote:
> > > Hi!
> > >
> > > How can I build KMainWindow menus dynamically (not via XMLGUI file), so
> > > even keyboard shortcuts work?
> > >
> > > Thanks for any hints.
> >
> > See documentation of KPopupMenu, QPopupMenu and KAction
>
> Do you mean:
>
> menu = new KPopupMenu
> action = new KAction (.... Key_K)
> action->plug (menu)
>
> ?
>
> It does not work. The shortcut is shown in the menu, but does not work.
> Selecting the menu entry directly work fine. I have to reconfigure the
> shortcut keys in UI to make it work.
>
> Stano
>
>
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
>
--
Muhammad Jibran
Software Engineer
Sidat Hyder Morshed (PVT) LTD
Off# 92-221-5693521-30
Cell# 92-300-2726414
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic