Unsolved FomLay out and its size
-
I am using spinbox and label in each row of Form layout.
I resized the spinbox. and add it to the form layout.
but the size of the form layout is not equal to the widgets in it.below code, i have used.
m_spinFreq= new QSpinBox(); m_spinFreq->setFixedSize(QSize(100,35)); m_spinPhase= new QSpinBox(); m_spinPhase->setFixedSize(QSize(100,35)); m_spinTE= new QSpinBox(); m_spinTE->setFixedSize(QSize(100,35)); m_spinTR= new QSpinBox(); m_spinTR->setFixedSize(QSize(100,35)); m_labFreq->setText("Freq"); m_labPhase= new QLabel(); m_labPhase->setText("Phase"); m_labTE= new QLabel(); m_labTE->setText("TE (ms)"); m_labTR= new QLabel(); m_labTR->setText("TR (ms)"); m_formLayBasicOne=new QFormLayout(); m_formLayBasicOne->setSpacing(30); m_formLayBasicOne->setLabelAlignment(Qt::AlignVCenter); m_formLayBasicOne->addRow(m_labFreq,m_spinFreq); m_formLayBasicOne->addRow(m_labPhase,m_spinPhase); m_formLayBasicOne->addRow(m_labTE,m_spinTE); m_formLayBasicOne->addRow(m_labTR,m_spinTR); m_formLayBasicOne->setSpacing(30); this->setLayout(m_formLayBasicOne);
Output
I want to fix the layout size to its widget. ?
Here widget in form layout occupied less space but too much free space is there. how can I avoid free space of right and bottom? -
You are calling setSpacing twice. Set some minimum size to your main widget.
-
@BinuJanardhanan said in FomLay out and its size:
Here widget in form layout occupied less space but too much free space is there. how can I avoid free space of right and bottom?
widgetWithFormLayout->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );