Hello,

On Wednesday 07 August 2013 17:11:09 Reza Shah wrote:
> Below are the new codes(simplified), but i have doubt how to use
> globalShortcutChanged, and effectShortcutChanged properly.
> ---------------------------
> QList<QKeySequence> cubeShortcut;
> QList<QKeySequence> cylinderShortcut;
> 
> QAction* cubeAction;
> QAction* cylinderAction;
> 
> //Set shortcut
> KGlobalAccel::self()->setShortcut(cubeAction, QList<QKeySequence>() <<
> Qt::CTRL + Qt::Key_F11);
> KGlobalAccel::self()->setShortcut(cylinderAction, QList<QKeySequence>());
> 
> //Get shortcut in new way.
> cubeShortcut = KGlobalAccel::self()->shortcut(cubeAction);
> cylinderShortcut = KGlobalAccel::self()->shortcut(cylinderAction);
> 
> //Is this correct?, also if i have many QAction only one connect needed?
> connect(KGlobalAccel::self(), SIGNAL(globalShortcutChanged(QAction *,
> QKeySequence)), this, SLOT(effectShortcutChanged(QAction *, QKeySequence)));
> 
> //Is this correct?
> void effectShortcutChanged(QAction * action, const QKeySequence& seq)
> {
>     if (action == cubeAction) {
>         cubeShortcut = QList<QKeySequence>()  <<  seq;
>     } else if (action == cylinderAction) {
>         cubeShortcut = QList<QKeySequence>()  <<  seq;
>     }
> }
> ------------------------------

Looks correct to me indeed.

Cheers.
-- 
Kévin Ottens, http://ervin.ipsquad.net

KDAB - proud supporter of KDE, http://www.kdab.com

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

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to