Results 1 to 4 of 4

Thread: QAction shortcuts from QLineEdit

  1. #1
    Join Date
    Mar 2007
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default QAction shortcuts from QLineEdit

    Hi, I have a QLineEdit area where the user types. I also have a bunch of QActions with shortcuts. When the user is typing in the QLineEdit area it triggers QActions due to conflicting shortcut key sequences. Is there a way to disable shortcuts when the QLineEdit area has focus?

    Thanks.
    Stu

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QAction shortcuts from QLineEdit

    Like Disco STU I like disco music...

    You can try following solutions

    a) Check in each QAction-slot-function if QLineEdit has the focus and break execution if true

    b) Write your own event handler for QFocusEvent. gotFocus(): disable the signals, lostFocus(): enable it again.


    Lykurg

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

    Default Re: QAction shortcuts from QLineEdit

    Where did you assign the actions to? Could we see the code?

  4. #4
    Join Date
    Mar 2007
    Posts
    16
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QAction shortcuts from QLineEdit

    Quote Originally Posted by Lykurg View Post
    Like Disco STU I like disco music...

    You can try following solutions

    a) Check in each QAction-slot-function if QLineEdit has the focus and break execution if true

    b) Write your own event handler for QFocusEvent. gotFocus(): disable the signals, lostFocus(): enable it again.


    Lykurg
    Thanks, but i don't want the action to be disabled, just the shortcut. It seems that the only way you can disable the shortcut is to set it to empty string. So does this mean that everytime QLineEdit get's focus I have to loop through all my QActions and set their shorcuts to "" ?

    btw, I am using fullmetalcoder's qshortcutmanager

Similar Threads

  1. Replies: 1
    Last Post: 26th November 2006, 09:32
  2. Creatin Key Pad shortcuts
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 19th May 2006, 05:50
  3. Replies: 1
    Last Post: 18th March 2006, 16:37
  4. Menu shortcuts in Visual Studio?
    By kw in forum Qt Programming
    Replies: 1
    Last Post: 16th March 2006, 23:30
  5. a box around QLineEdit?
    By GreyGeek in forum Qt Tools
    Replies: 13
    Last Post: 8th February 2006, 15:40

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.