Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

toolbar-> resize( 200, 20 );

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top