[Interest] How do i get the Qt::Key values from QKeySequence?

Mark Gaiser markg85 at gmail.com
Wed Jan 1 23:47:58 CET 2014


This time to the list as well...
Op 1 jan. 2014 23:33 schreef "Mark Gaiser" <markg85 at gmail.com>:

>
> Op 1 jan. 2014 21:55 schreef "Jonathan Greig" <redteam316 at gmail.com>:
> >
> > Whats wrong with using QKeySequence::toString stored in a QHash? Then
> make a function that breaks them apart or combines them depending on if you
> are storing them or looking them up?
>
> I want to use it in QKeyEvent which just knows about the Qt::Key values,
> not the string versions (as far as I know). And I really like to avoid
> making a lookup table for all the values in Qt::Key.
>
> Oh, and have you seen the logic in the QKeySequence source that turns
> strings to Qt::Key? It's quite some code. Not something I'd like to mimic
> or copy thus I'm asking for a possible way to get Qt::Key values from
> QKeySequence.
>
> >
> >
> > On Wed, Jan 1, 2014 at 1:01 PM, Mark Gaiser <markg85 at gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I'm using QKeySequence [1] and am trying to extend it's functionality
> >> to add mouse support.
> >> But in my structure i use stuff like:
> >>
> >> QVector<Qt::Key> keys;
> >>
> >> So now i want to have a vector with the keys in it.
> >> If i create a QKeySequence("Ctrl+A") i want to have:
> >> Qt::Key_Control
> >> Qt::Key_A
> >>
> >> Added to the vector, but how do i retrieve those from QKeySequence? I
> >> don't see an option for it..
> >>
> >> The only option i see right now is diving in QKeySequencePrivate and
> >> grabbing it's string parsing logic. But that seems a bit overkill to
> >> me.
> >>
> >> Side note: QKeySequence::count() seems to return just the non modifier
> >> key count. In the above example it would return 1 where i would expect
> >> 2. (Control is a key, right?) Why is it returning 1?
> >>
> >> Cheers,
> >> Mark
> >> _______________________________________________
> >> Interest mailing list
> >> Interest at qt-project.org
> >> http://lists.qt-project.org/mailman/listinfo/interest
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140101/ce3b7470/attachment.html>


More information about the Interest mailing list