I want to add a colored Widget over the full QStatusBar. I added a QLabel with red background-color but there is a padding around the label, which i can't remove.
what i tried:
- setSizeGripEnabled(false)
- setStyleSheet("QStatusBar { border: 0px; padding: 0px; margin: 0px; }" "QStatusBar::item { border: 0px; padding: 0px; margin: 0px; }"
- layout()->setContentsMargins(0, 0, 0, 0);

Update: Example Code:
QWidget *w = new QWidget;
QHBoxLayout *layout = new QHBoxLayout;
QStatusBar *statusBar = new QStatusBar;
QLabel *label = new QLabel("Example");
w->setStyleSheet("background-color: green");
label->setStyleSheet("background-color: red");
statusBar->addPermanentWidget(label, 1);
statusBar->layout()->setContentsMargins(0, 0, 0, 0);
statusBar->setSizeGripEnabled(false);
setStatusBar(statusBar);
w->setLayout(layout);
setCentralWidget(w);
}
I think it is not possible without pointer hacking or reimplementing all QStatusBar functionality because
QStatusBarimplementation based on pimpl idiom, which means some implementation hidden in private headers and borders betweenQStatusBarwidget and children widgets are hardcoded in qstatusbar.cpp