Results 1 to 4 of 4

Thread: How convert Qt::Key to QString?

  1. #1
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How convert Qt::Key to QString?

    How convert Qt::Key to QString?

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: How convert Qt::Key to QString?

    1) Check that it is in the range of characters and 2) create a string with QString::number(code)

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How convert Qt::Key to QString?

    Quote Originally Posted by lenny View Post
    How convert Qt::Key to QString?
    Do you want to take:
    Qt Code:
    1. Qt::Key key = Qt::Key_Semicolon;
    To copy to clipboard, switch view to plain text mode 
    and turn it into ";" or "Qt::Key_Semicolon"?

    If you got the Qt::Key value in a QKeyEvent then QKeyEvent::text() may be useful.

  4. #4
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How convert Qt::Key to QString?

    Qt::Key key = Qt::Key_W;
    qDebug() << QKeySequence(key).toString();
    No longer necessary.

Similar Threads

  1. convert Qstring into int
    By sabbu in forum Newbie
    Replies: 8
    Last Post: 8th June 2011, 16:31
  2. convert QString to int
    By mattia in forum Newbie
    Replies: 2
    Last Post: 4th January 2008, 09:10
  3. how to convert int to QString?
    By phillip_Qt in forum Newbie
    Replies: 2
    Last Post: 5th October 2007, 08:07
  4. convert BYTE* to QString
    By tpf80 in forum Qt Programming
    Replies: 6
    Last Post: 8th April 2007, 10:29
  5. How to convert Int to QString in QT4?
    By drake1983 in forum Newbie
    Replies: 2
    Last Post: 11th March 2007, 06:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.