[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: KShortcut and properties
From: "Thiago Macieira" <thiago () kde ! org>
Date: 2007-04-17 15:19:00
Message-ID: 4323.172.26.0.1.1176823140.squirrel () 172 ! 26 ! 0 ! 1
[Download RAW message or body]
Jakub Stachowski wrote:
> Hello,
>
> KAction has two properties of type KShortcut: shortcut and globalShortcut.
> The
> problem is that KShortcut is not registered with Qt metatype system so it
> cannot really be used as type of property. This causes bug in
> KXMLGUIFactory::configureAction - it reads shortcuts from .ui file (
> ActionProperties node) and tries to set them using setProperty("shortcut",
> [QString with shortcut definition]. This will fail because bug mentioned
> above and because QString won't be casted to KShortcut automatically.
> Attached is patch that fixes both KShortcut-as-property problem (did i put
> qRegisterMetaType calls in proper places?) and casting in KXMLGUIFactory.
Patch looks good.
Just the following:
#include <QtCore/QList>
#include <QtGui/QKeySequence>
+#include <QMetaType>
it should be QtCore/QMetaType.
While you're at it, here are some suggested improvements for KShortcut:
* add operator QVariant() const { return qVariantFromValue(*this); }, just
like QKeySequence has it.
Unlike KUrl, KShortcut's base class won't cause us problems
* make qHash(const KShortcut &) non-inline. I don't think it's a good idea
to have qHash on a Qt type (QKeySequence) in one of our public header
files. Actually, the whole qHash function looks dangerous to me the way it
is written.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic