Results 1 to 8 of 8

Thread: Tab Ordering not working properly in widget

  1. #1
    Join Date
    Jul 2016
    Posts
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Tab Ordering not working properly in widget

    Hi everyone,

    I'm having an issue and I typically hate asking questions on forums. The issue is the tab order on one of my widgets. I know QT sets tab ordering based upon the order in which the widgets are created in the designer. Luckily this ordering is working. However, the tab ordering is completely off. When I manually set Tab ordering by setTabOrder(widget*, widget*), this tab ordering is also not being followed. Here is an example of some of my code.

    setTabOrder(ui->m_tableView, ui->widget);
    setTabOrder(ui->widget, ui->m_editWidget);
    setTabOrder(ui->m_editWidget, ui->m_setInputWidget);
    setTabOrder(ui->m_setInputWidget, ui->m_tableView);

    Just as a note m_editWidget and widget are container widgets of spinboxes and other things. m_setInputWidget is a customer widget that was "promoted" using Qt's promote functionality. From my understanding the tab order should tab to these specific widgets and the tab through those widgets sub widgets through the default QWidget::focusNextPrevChild. So if anyone has any ideas or suggestions to help me, I'd be most appreciative.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Tab Ordering not working properly in widget

    Since "ui" suggests you have created the widget in designer, wouldn't it be easiest to just set the tab order in designer?

    http://doc.qt.io/qt-5/designer-tab-order.html

    Cheers,
    _

  3. #3
    Join Date
    Jul 2016
    Posts
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Tab Ordering not working properly in widget

    I have tried that. The ordering is correct in designer. However, it still is not tabbing properly.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Tab Ordering not working properly in widget

    Hmm, always worked for me but I've never wanted to set focus on a widget that doesn't have keyboard input capability.

    Cheers,
    _

  5. #5
    Join Date
    Jul 2016
    Posts
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Tab Ordering not working properly in widget

    What do you think I should do? I would've thought this to be a simple issue. Usually the forum is the last place I go to for help, because typically someone has always asked the question before.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Tab Ordering not working properly in widget

    Well, my approach would be to set the tab order in designer, to each of the input elements.

    I.e. if "ui->widget" is not an input widget, it would not be in the tab order chain, only the actual input widgets inside it would be.

    Cheers,
    _

  7. #7
    Join Date
    Mar 2018
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Tab Ordering not working properly in widget

    Was this ever resolved? I am having a similar problem. I used the 'Edit Tab Order' tool in QtDesigner to set the tab order for a bunch of basic widgets like LineEdits and ComboBoxes. But, when I execute my program, the tab order still follows the original order of creation. I have tried changing the focus policy, which did not make any difference. The tab orders I set show up in the .ui file within <tabstop> tags -- do I have to do something in my main code to recognize these?

  8. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Tab Ordering not working properly in widget

    Is your UI file being recompiled (via UIC) when you build your program? If the "ui_xyz.h" file isn't being regenerated on a build after the ui file has changed, then the changes won't show up.

    Try manually deleting the ui...h file in the appropriate GeneratedFiles subdirectory. You will get an error if the build dependencies are not set up correctly to build the .h file before it is needed to compile the Qt class that includes it.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. How to get properly working MinGW 4.4 ?
    By bisz in forum Installation and Deployment
    Replies: 0
    Last Post: 12th November 2013, 07:58
  2. Qt Creator Cmake is not working properly
    By Tabbu in forum Qt Tools
    Replies: 0
    Last Post: 12th January 2013, 07:38
  3. Replies: 1
    Last Post: 7th December 2011, 00:49
  4. memcpy not working properly
    By sattu in forum Qt Programming
    Replies: 3
    Last Post: 26th October 2010, 23:33
  5. ScrollZoomer not working properly..
    By Raghaw in forum Qwt
    Replies: 1
    Last Post: 30th October 2009, 06:51

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.