Results 1 to 5 of 5

Thread: QTabWidget: How to move to another page using keypoard instead mouse?

  1. #1
    Join Date
    Jan 2008
    Location
    Davao City, Philippines
    Posts
    77
    Thanks
    16
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Unhappy QTabWidget: How to move to another page using keypoard instead mouse?

    Hi guys,

    can anybody point me to a way, to switch from one page to another inside a QTabWidget using the keyboard instead the mouse? Something similar to

    int n;
    n = currentIndex ();
    ++n;

    tabWidget->setCurrentIndex( n );
    but using PgUp / PgDown or something similar instedt?

    I have tried it with QKeyEvent and QKeySequence, but I guess the problem is, that my tabWidget don't has a focus.

    Thanks in advance.

  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: QTabWidget: How to move to another page using keypoard instead mouse?

    Install an event filter and check there for key events.

  3. #3
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    63
    Thanks
    1
    Thanked 22 Times in 19 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QTabWidget: How to move to another page using keypoard instead mouse?

    Maybe one way would be to add ampersand (&) to tab label as described in the documentation http://doc.trolltech.com/latest/qtabwidget.html#addTab i.e. to add shortcut to each tab, but if you have some issues with the focus then this might not help.

  4. #4
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTabWidget: How to move to another page using keypoard instead mouse?

    Hi,

    I use QTabWidget a lot - on Windows XP I use Control/Tab to flit between tabs - I assume this works with other Windows variants.

    SteveH

  5. #5
    Join Date
    Jan 2008
    Location
    Davao City, Philippines
    Posts
    77
    Thanks
    16
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTabWidget: How to move to another page using keypoard instead mouse?

    Thanks to all of you for helping me.

    Quote Originally Posted by tsp View Post
    Maybe one way would be to add ampersand (&) to tab label as described in the documentation http://doc.trolltech.com/latest/qtabwidget.html#addTab i.e. to add shortcut to each tab, but if you have some issues with the focus then this might not help.
    I have tried to install an eventFilter. It's working well but I will use the shortcuts now, like tsp has told me. I don't no, that I can use shortcuts in a tabWidget because it's not included in the settings for a tabWidget in the designer.

    Ctrl-Tab, like Steve has advised is working too, but in some cases I have many pages so it's really faster to use shortcuts.

    Thanks again to everybody.

Similar Threads

  1. how to detach Tab page from QTabWidget?
    By rajesh in forum Newbie
    Replies: 3
    Last Post: 30th May 2012, 16:20
  2. How to move the mouse ?
    By shad0w in forum Newbie
    Replies: 3
    Last Post: 2nd November 2008, 13:55
  3. QTabWidget remove a page at the page's request
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2007, 20:45
  4. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34
  5. How to move next page in stackedwidget ?
    By npc in forum Qt Programming
    Replies: 1
    Last Post: 10th January 2007, 14:24

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.