sgt pepper February 2016

How to make window look symmetric after adding buttons to taskbar?

I have QMainWindow and I want to populate statusbar with buttons.

I achieve this by using the code:

QWidget *widget = new QWidget();
QPushButton *leftBut = new QPushButton("left");
QPushButton *rightBut = new QPushButton("right");
QHBoxLayout *layout = new QHBoxLayout(widget);
layout->addWidget(leftBut, 1, 0);
layout->addWidget(rightBut, 1, 0);
statusBar()->addWidget(widget,1);

so, I have this: MainWindow with buttons in statusbar

But you can see that right border of layout are far from window corner, not like on the left side.

What I want is to make window look symmetric (move right border right or make borders invisible or something else).

Answers


sgt pepper February 2016

What was needed is this string after those code that I wrote in question:

statusBar()->setSizeGripEnabled(false);

In some reason statusbar contains "size grip" that is situated in bottom-right corner of statusbar and is enabled by default. That wast the thing that prevent widget to fill whole space.

Post Status

Asked in February 2016
Viewed 2,088 times
Voted 10
Answered 1 times

Search




Leave an answer