Results 1 to 4 of 4

Thread: setting tab order for custom widgets not working

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default setting tab order for custom widgets not working

    hi friends/Experts,
    Im trying to set the tab order for the Custom widget im adding on the widget created by designer.

    I used scrollArea and a line edit . so when the user enter 10, 10 custom widgets will be added to the scroll area.

    I set the scrollArea tab no as ex:5 and 6,7 and 8 to the ok , cancel, clear push buttons.

    when the text entered in the edit
    entries = LineEdit entry.

    Qt Code:
    1. while(entries)
    2. {
    3. SpeciesInfo *SpeciesParent = new SpeciesInfo(this);
    4.  
    5. m_speciesList<<SpeciesParent;
    6.  
    7. scrollLayout->addWidget(SpeciesParent); //Entries added to scrollarea layout
    8.  
    9.  
    10. entries --;
    11. }
    12.  
    13.  
    14.  
    15. ui.speciesScrollArea->setFocusProxy(m_speciesList.at(0));
    16. ui.speciesScrollArea->setFocusPolicy(Qt::TabFocus);
    To copy to clipboard, switch view to plain text mode 

    but the taborder is coming to speciesInFo only after ok,cancel and clear button. tab order is not coming inside the speciesInfo when it reach the tab on ScrollArea.

    addition information:
    Qt Code:
    1. scrollLayout = new QVBoxLayout;
    2. scrollWidget->setLayout(scrollLayout);
    3. ui.speciesScrollArea->setWidget(scrollWidget);
    4. ui.speciesScrollArea->setContentsMargins(0,0,0,0);
    5. ui.speciesScrollArea->viewport()->setAutoFillBackground(true);
    To copy to clipboard, switch view to plain text mode 

    inside SpeciesInfo policy setFocusPolicy(Qt::TabFocus);

    please help me. thanks in advanceSpProblem.png
    Last edited by wagmare; 15th December 2015 at 12:29.
    "Behind every great fortune lies a crime" - Balzac

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,316
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: setting tab order for custom widgets not working

    I don't see that you are setting tab order at all. You set the focus policy and focus proxy for one of your widgets, but that says nothing about tab order.

    Look at the static method QWidget::setTabOrder().

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setting tab order for custom widgets not working

    thanks for reply d_stanz. the scrollArea tabOrder is set to say 8. so when the eighth tab comes the focus has to enter into the custom widget but it is not doing so. the custom widget receives the tab focus only after ok,clear and cancel button tab focus which is 10, 11 and 12th index.
    "Behind every great fortune lies a crime" - Balzac

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,316
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: setting tab order for custom widgets not working

    Are you calling QWidget::setTabOrder() on your newly-created widgets? If not, I am pretty sure they will be added to the tab order after any existing widgets.

Similar Threads

  1. Controlling Property Setting Order
    By thePoet in forum Qt Tools
    Replies: 1
    Last Post: 13th July 2010, 19:29
  2. Tab Order is Not Working
    By kavinsiva in forum Newbie
    Replies: 6
    Last Post: 18th June 2010, 12:01
  3. setting tab order on MAC
    By gren15 in forum Qt Tools
    Replies: 0
    Last Post: 3rd July 2009, 21:08
  4. Setting Tab order
    By Rakesh_Kumar in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2009, 04:58
  5. Z order for 'standard' widgets.
    By nouknouk in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2006, 19:59

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.