Unable to align Formlayout



  • 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.


  • Moderators

    @Adit Maybe it's alignment in the QHBoxLayout?



  • 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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.