QAction and KGlobalAccel::globalShortcutChanged signal in KF5
Hi, I'm trying to port KAction to QAction. The old codes something like below: -- KShortcut cubeShortcut, cylinderShortcut; KAction* cubeAction, * cylinderAction; cubeShortcut = cubeAction->globalShortcut(); connect(cubeAction, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(cubeShortcutChanged(QKeySequence))); void cubeShortcutChanged(const QKeySequence& seq) { cubeShortcut = KShortcut(seq); } --- Below are the new codes(simplified), but i have doubt how to use globalShortcutChanged, and effectShortcutChanged properly. --- QList cubeShortcut; QList cylinderShortcut; QAction* cubeAction; QAction* cylinderAction; //Set shortcut KGlobalAccel::self()->setShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); KGlobalAccel::self()->setShortcut(cylinderAction, QList()); //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() << seq; } else if (action == cylinderAction) { cubeShortcut = QList() << seq; } } -- Regards, Reza >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
Re: QAction and KGlobalAccel::globalShortcutChanged signal in KF5
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 cubeShortcut; > QList cylinderShortcut; > > QAction* cubeAction; > QAction* cylinderAction; > > //Set shortcut > KGlobalAccel::self()->setShortcut(cubeAction, QList() << > Qt::CTRL + Qt::Key_F11); > KGlobalAccel::self()->setShortcut(cylinderAction, QList()); > > //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() << seq; > } else if (action == cylinderAction) { > cubeShortcut = QList() << seq; > } > } > -- Looks correct to me indeed. Cheers. -- Kévin Ottens, http://ervin.ipsquad.net KDAB - proud supporter of KDE, http://www.kdab.com signature.asc Description: This is a digitally signed message part. >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
Re: QAction and KGlobalAccel::globalShortcutChanged signal in KF5
Thanks a lot. Regards, Reza On Wed, Aug 7, 2013 at 7:50 PM, Kevin Ottens wrote: > 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 cubeShortcut; > > QList cylinderShortcut; > > > > QAction* cubeAction; > > QAction* cylinderAction; > > > > //Set shortcut > > KGlobalAccel::self()->setShortcut(cubeAction, QList() << > > Qt::CTRL + Qt::Key_F11); > > KGlobalAccel::self()->setShortcut(cylinderAction, QList()); > > > > //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() << seq; > > } else if (action == cylinderAction) { > > cubeShortcut = QList() << seq; > > } > > } > > -- > > Looks correct to me indeed. > > Cheers. > -- > Kévin Ottens, http://ervin.ipsquad.net > > KDAB - proud supporter of KDE, http://www.kdab.com > > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to > unsubscribe << > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
Question about license
What happens if I copy code which has BSD license to my file which has GPL license. Do both licence exist together or something else? This question is related to Plasma Media Center bug https://bugs.kde.org/show_bug.cgi?id=323254 . Thanks -- http://www.sinny.in >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
Re: Question about license
On quinta-feira, 8 de agosto de 2013 01:01:32, Sinny Kumari wrote: > What happens if I copy code which has BSD license to my file which has GPL > license. Do both licence exist together or something else? > > This question is related to Plasma Media Center bug > https://bugs.kde.org/show_bug.cgi?id=323254 . Each section of the code independently maintains its own copyright. You should be clear where you copied the code from and under what license it came from. (add some comments to your source) However, the combined work gets to be licensed under the union of the two licenses. A 2- or 3-clause BSD license adds no requirements on top of the GPLv2 or v3, which means that the combined work retains the GPL license from the rest of the code. A 4-clause BSD license adds one requirement on top of the GPL. For that reason, redistribution is not permitted and the 4-clause BSD license is considered incompatible with the GPL. Do not combine works containing the 4- clause BSD license with GPL code. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 signature.asc Description: This is a digitally signed message part. >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
Re: Question about license
Hi Sinny, On Thursday, August 08, 2013 01:01:32 Sinny Kumari wrote: > What happens if I copy code which has BSD license to my file which has GPL > license. Do both licence exist together or something else? You can just let the BSD license as is, or relicense the BSD code to (L)GPL, both are legal and valid. If you collate GPL and BSD code in the same file, you'll likely want to just assume the GPL. The BSD license basically gives you the freedom to relicense the code. Usually, you want to state in your code where the (BSD-)code comes from, for that, a comment should be enough. > This question is related to Plasma Media Center bug > https://bugs.kde.org/show_bug.cgi?id=323254 . I'd just state, under the GPL header "This code was taken from yadda yadda, originally licensed under the BSD-2-clause license. You can find hte original version here." Or, go for the BSD license, and remove the GPL header (if both copyright holders are OK with that.) Cheers, -- sebas http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9 >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<