user2543127
user2543127

Reputation: 415

QT - Resize QToolbar

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

Upvotes: 1

Views: 3524

Answers (3)

phyatt
phyatt

Reputation: 19102

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.

Upvotes: 2

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.

Upvotes: 0

Exa
Exa

Reputation: 4110

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

toolbar-> resize( 200, 20 );

Upvotes: 1

Related Questions