Commit 371e08da authored by schurade's avatar schurade
Browse files

[FIX] linedit width for sliderwithedit widget, added a stretch so controls in...

[FIX] linedit width for sliderwithedit widget, added a stretch so controls in the tab widget don't spread
parent 87dbd038
......@@ -31,8 +31,10 @@
WQtDSBWidget::WQtDSBWidget( std::string name, QWidget* parent )
: QWidget( parent ),
m_name( name.c_str() ),
m_layout()
m_controlLayout(),
m_pageLayout()
{
m_pageLayout.addLayout( &m_controlLayout );
}
......@@ -43,31 +45,31 @@ WQtDSBWidget::~WQtDSBWidget()
QPushButton* WQtDSBWidget::addPushButton( QString label )
{
int row = m_layout.rowCount();
int row = m_controlLayout.rowCount();
QPushButton* button = new QPushButton();
button->setText( label );
m_layout.addWidget( button, row, 0 );
m_controlLayout.addWidget( button, row, 0 );
setLayout( &m_layout );
setLayout( &m_pageLayout );
return button;
}
WQtCheckBox* WQtDSBWidget::addCheckBox( QString label, bool isChecked )
{
int row = m_layout.rowCount();
int row = m_controlLayout.rowCount();
QLabel* qlabel = new QLabel( label );
WQtCheckBox* checkBox = new WQtCheckBox();
checkBox->setName( label );
checkBox->setChecked( isChecked );
m_layout.addWidget( qlabel, row, 0 );
m_layout.addWidget( checkBox, row, 1 );
m_controlLayout.addWidget( qlabel, row, 0 );
m_controlLayout.addWidget( checkBox, row, 1 );
setLayout( &m_layout );
setLayout( &m_pageLayout );
return checkBox;
}
......@@ -75,17 +77,17 @@ WQtCheckBox* WQtDSBWidget::addCheckBox( QString label, bool isChecked )
WQtLineEdit* WQtDSBWidget::addLineEdit( QString label, QString text )
{
int row = m_layout.rowCount();
int row = m_controlLayout.rowCount();
QLabel* qlabel = new QLabel( label );
WQtLineEdit* lineEdit = new WQtLineEdit();
lineEdit->setName( label );
lineEdit->setText( text );
m_layout.addWidget( qlabel, row, 0 );
m_layout.addWidget( lineEdit, row, 1 );
m_controlLayout.addWidget( qlabel, row, 0 );
m_controlLayout.addWidget( lineEdit, row, 1 );
setLayout( &m_layout );
setLayout( &m_pageLayout );
return lineEdit;
}
......@@ -93,7 +95,7 @@ WQtLineEdit* WQtDSBWidget::addLineEdit( QString label, QString text )
WQtSliderWithEdit* WQtDSBWidget::addSliderInt( QString label, int value, int min, int max )
{
int row = m_layout.rowCount();
int row = m_controlLayout.rowCount();
QLabel* qlabel = new QLabel( label );
WQtSliderWithEdit* slider = new WQtSliderWithEdit( label );
......@@ -102,14 +104,20 @@ WQtSliderWithEdit* WQtDSBWidget::addSliderInt( QString label, int value, int min
slider->setMax( max );
slider->setValue( value );
m_layout.addWidget( qlabel, row, 0 );
m_layout.addWidget( slider, row, 1 );
m_controlLayout.addWidget( qlabel, row, 0 );
m_controlLayout.addWidget( slider, row, 1 );
setLayout( &m_layout );
setLayout( &m_pageLayout );
return slider;
}
void WQtDSBWidget::addSpacer()
{
m_pageLayout.addStretch();
setLayout( &m_pageLayout );
}
QString WQtDSBWidget::getName()
{
return m_name;
......
......@@ -77,6 +77,13 @@ public:
*/
WQtSliderWithEdit* addSliderInt( QString label, int value = 0, int min = 0, int max = 100 );
/**
* helper function to add a spacer at the end
*/
void addSpacer();
/**
* getter for m_name
*/
......@@ -85,7 +92,8 @@ public:
protected:
private:
QString m_name;
QGridLayout m_layout;
QGridLayout m_controlLayout;
QVBoxLayout m_pageLayout;
};
#endif // WQTDSBWIDGET_H
......@@ -184,6 +184,8 @@ void WQtDatasetBrowser::selectTreeItem()
}
}
}
tab1->addSpacer();
addTabWidgetContent( tab1 );
}
......
......@@ -73,6 +73,8 @@ void WQtSliderWithEdit::setMax( int max )
fmax /= 10.0;
}
m_edit.setMaxLength( length );
m_edit.setMaximumWidth( m_edit.minimumSizeHint().width() * length / 2 );
m_edit.resize( m_edit.minimumSizeHint().width() * length / 2, m_edit.size().height() );
}
void WQtSliderWithEdit::setValue( int value )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment