PDA

View Full Version : How to adjust the size of widgets added to a QToolBar?



fisyher84
9th September 2011, 05:04
I have added a slider inside a QToolBar using AddWidget() directly as follows:


m_PreviewFrameSlider = new QSlider();
m_PreviewFrameSlider->setRange(0, 1000);
m_PreviewFrameSlider->setOrientation(Qt::Horizontal);

ui->PreviewToolBar->addWidget(m_PreviewFrameSlider);

The slider appears as expected but is a little too narrow (about 100 pix. I want to adjust the width of the slider to at least 300 pix. I could not find any methods that can do so. Can someone give me some tips on how to do so?

ChrisW67
9th September 2011, 06:14
QWidget::setMinimumWidth() looks promising.

fisyher84
13th September 2011, 02:54
Thanks alot! It worked perfectly.