Results 1 to 2 of 2

Thread: QShortcut not work!

  1. #1

    Question QShortcut not work!

    hello, i want to use a hot key in my widget and i do it like this:
    Qt Code:
    1. TextEdit::TextEdit(QWidget *parent)
    2. : QsciScintilla(parent)
    3. {
    4. QShortcut *shortCut = new QShortcut(QKeySequence("F1"),this);
    5. connect( shortCut, SIGNAL(activated() ), this, SLOT( wrap_word()) );
    6. }
    To copy to clipboard, switch view to plain text mode 

    it not work, can anyone help me?

    Thanks.
    Ryan Lee

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QShortcut not work!

    You are probably creating the shortcut on a wrong widget. The viewport is the widget having focus. At least if your base class follows standard patterns.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QShortcut SIGNAL must be of 0 arguments?
    By Wasabi in forum Newbie
    Replies: 1
    Last Post: 17th August 2010, 22:26
  2. Replies: 2
    Last Post: 13th December 2009, 21:27
  3. QShortcut not working
    By berinder in forum Qt Programming
    Replies: 0
    Last Post: 24th November 2008, 11:20
  4. QShortcut
    By SailinShoes in forum Qt Programming
    Replies: 4
    Last Post: 17th October 2008, 11:42
  5. QShortcut - doesn't work with Qt::Key_Return
    By naresh in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2006, 13:00

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.