Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to get Qwidget that added to Vertical lay out

    General and Desktop
    2
    2
    942
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mehdi.nine last edited by

      Hi, i add Some Widget to a Vertical lay out. now i want retrieve them like this:

      @
      for(int i =0; i < ui->verticalLayout_6->children().count(); i++)
      {
      QWidget* Widget = dynamic_cast<QWidget*>(ui->verticalLayout_6->children().at(i));
      if(Widget != NULL)
      {
      for(int j = 0; j < Widget->children().count(); j++)
      {
      QLineEdit TempLine = dynamic_cast<QLineEdit>(Widget->children().at(j));
      if(TempLine != NULL)
      {
      TempLine->setText("peida kardam :D :P");
      }
      }

              }
      
      
          }
      

      @
      but ui->verticalLayout_6->children().count(); returns 0. how can i retrieve them?
      any idea?
      another question is that how can change space between Pushbuttons that added to Vertical lay out. I use
      @
      ui->verticalLayout->setSpacing(1);
      @
      but i doesn't work.
      any idea?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Since it looks like you have an UI file... Do you add your widgets programmatically ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • First post
          Last post