PDA

View Full Version : Add a QSpinBox in the ToolBar



OzQTNoob
16th October 2012, 07:59
Okay so how do I add a spinbox into the toolbar via the Qt Creator?

I have other actions in there (open, close, save etc) which is fine because they are represented by an icon, but a spinbox wont stick in there as it were.

Cheers
Oz

Okay so how do I add a spinbox into the toolbar via the Qt Creator?

I have other actions in there (open, close, save etc) which is fine because they are represented by an icon, but a spinbox wont stick in there as it were.

Cheers
Oz

Added after 1 40 minutes:

Solved: Has to be done within code and not in the creator if its a widget (same applies to the statusbar I think. At least a post I saw that Wysota replied to said as much. Thanks Wysota)

e.g. in the MainWindow constructor

QSpinBox *spinBox = new QSpinBox(this);
ui->toolBar->addWidget(spinBox);

Cheers
Oz