The style puts separators between separate widgets in the status bar. If you do not want separators between your widgets in the status bar then only insert a single widget. You then have complete control over the layout of other widgets within that single widget. This is what anda_skoa suggested above, and you have not done in your code.
// You are doing the equivalent of this
sb
->addWidget
(new QLabel("A"));
sb
->addWidget
(new QLabel("B"));
sb
->addWidget
(new QLabel("C"));
a.show();
// We are saying do this
layout
->addWidget
(new QLabel("D"));
layout
->addWidget
(new QLabel("E"));
layout
->addWidget
(new QLabel("F"));
layout->setContentsMargins(0,0,0,0);
container->setLayout(layout);
sb->addWidget(container);
b.show();
// You are doing the equivalent of this
QMainWindow a;
QStatusBar *sb = a.statusBar();
sb->addWidget(new QLabel("A"));
sb->addWidget(new QLabel("B"));
sb->addWidget(new QLabel("C"));
a.show();
// We are saying do this
QMainWindow b;
QStatusBar *sb = b.statusBar();
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(new QLabel("D"));
layout->addWidget(new QLabel("E"));
layout->addWidget(new QLabel("F"));
layout->setContentsMargins(0,0,0,0);
QWidget *container = new QWidget;
container->setLayout(layout);
sb->addWidget(container);
b.show();
To copy to clipboard, switch view to plain text mode
Bookmarks