1

i have some concatenate toolbar. For every toolbar i have call:

toolbar->setGeometry(x,y,width,height)

but i have no resize.

I try to call

toolbar->updateGeometry();

but nothing.

My goal is to expand every toolbar with my size definition

user2543127
  • 385
  • 10
  • 21

3 Answers3

2

There is a good chance you are using this for repositioning your toolbars on init and saving at closing.

Here is a solid way to do that:

What you really need is to use the QMainWindow saveGeometry() and restoreGeometry() functions and save and load the byte array through the QSettings interface.

writeSettings

QSettings s;

s.beginGroup("MainWindow");

this->restoreGeometry(s.value("geometry").toByteArray());
this->restoreState(s.value("windowState").toByteArray());

s.endGroup();

readSettings

QSettings s;

s.beginGroup("MainWindow");

s.setValue("geometry", saveGeometry());
s.setValue("windowState", saveState());

s.endGroup();

Hope that helps.

phyatt
  • 18,472
  • 5
  • 61
  • 80
1

You can try QWidget::resize( int w, int h ) to resize the toolbar.

toolbar-> resize( 200, 20 );
Exa
  • 4,020
  • 7
  • 43
  • 60
  • I would very much like to know how to do that **when** the toolbar is docked. Especially when working with touch screen it would be pretty nice. – rbaleksandar May 20 '16 at 11:43
0

The toolbar's geometry is either managed by a layout or by the main window.

You'd need to show how is the toolbar used/displayed.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313