Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to align Formlayout
Forum Updated to NodeBB v4.3 + New Features

Unable to align Formlayout

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 712 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Adit
    wrote on last edited by
    #1

    Hi All,I have a top Horizontal Layout, to which I have added Formlayout.The form layout gets aligned to the top by default.I tried to change its alignment ,but its not changing.Below is my code:

     QHBoxLayout *hParentLayout = new QHBoxLayout();
    
     QFormLayout *formLayout = new QFormLayout();
    
    //Create Label
    
    QLabel* label=new QLabel();
    label->setText("Text");
    
    QStringList list;
    list.push_back("English");
    
    QComboBox *comboBox = new QComboBox;
    comboBox->insertItems(0,list);
    
    formLayout->setAlignment(Qt::AlignBottom);//This is not changing
    formLayout->addRow(label, comboBox);
    
    hParentLayout->addLayout(formLayout);
    

    Any input will be really useful.

    jsulmJ 1 Reply Last reply
    0
    • A Adit

      Hi All,I have a top Horizontal Layout, to which I have added Formlayout.The form layout gets aligned to the top by default.I tried to change its alignment ,but its not changing.Below is my code:

       QHBoxLayout *hParentLayout = new QHBoxLayout();
      
       QFormLayout *formLayout = new QFormLayout();
      
      //Create Label
      
      QLabel* label=new QLabel();
      label->setText("Text");
      
      QStringList list;
      list.push_back("English");
      
      QComboBox *comboBox = new QComboBox;
      comboBox->insertItems(0,list);
      
      formLayout->setAlignment(Qt::AlignBottom);//This is not changing
      formLayout->addRow(label, comboBox);
      
      hParentLayout->addLayout(formLayout);
      

      Any input will be really useful.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Adit Maybe it's alignment in the QHBoxLayout?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Adit
        wrote on last edited by
        #3

        Thank you man,its working.But I have a question.Actually I had another child horizontal layout along with child form layout.But this child horizontal layout is center aligned by default and using childHorizontalLayout.setAlignment(..) call actually works.Then why this call didn't work for the Form Layout ?Any idea?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved