Results 1 to 3 of 3

Thread: KeyEvent to go to a parent/grandparent widget?

  1. #1
    Join Date
    Nov 2006
    Posts
    86
    Thanks
    6
    Thanked 14 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default KeyEvent to go to a parent/grandparent widget?

    Whats the best practice for sending up a keypress event to a widget that is probably its parent or grandparent?

    I've got a TabWidget that contains pages consisting of SSHWidget's. Now those SSHWidgets have a class inside them called Console. I wanted the user to be able to press Shift + Left and make my TabWidget move to the next tab. So I'm not sure if I should get a pointer in Console to the TabWidget, or if I should let the keyPress propagate up... or is there a better way? I hope that makes sense!

    Paul

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: KeyEvent to go to a parent/grandparent widget?

    An ignored key event should get propagated to receiver's parent.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    thomaspu (29th December 2007)

  4. #3
    Join Date
    Nov 2006
    Posts
    86
    Thanks
    6
    Thanked 14 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: KeyEvent to go to a parent/grandparent widget?

    Yeah, that was def a cleaner way to do it.

    Paul

Similar Threads

  1. Drawing a widget in QItemDelegate's paint method
    By darkadept in forum Qt Programming
    Replies: 17
    Last Post: 11th August 2009, 05:15
  2. Replies: 3
    Last Post: 17th October 2007, 12:52
  3. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52
  4. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.