'Modify line behind QStatusbar widgets
Is there a way to modify (remove) the line behind a permanent widget in a QStatusbar?

I don't know if it's important, but that's how I added the labels to the status bar:
wStyleTest::wStyleTest(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::wStyleTest)
{
// ...
ui->statusbar->addPermanentWidget(ui->lblPermWidget1);
ui->statusbar->addPermanentWidget(ui->lblPermWidget2);
// ...
Solution 1:[1]
Subclass QProxyStyle and reimplement the drawPrimitive method. In there, check for the QStyle::PE_FrameStatusBar element and return from it instead of calling the base method.
#include <QProxyStyle>
#include <QStyleOption>
class StyleFixes : public QProxyStyle
{
public:
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
if (element == QStyle::PE_FrameStatusBar)
return;
QProxyStyle::drawPrimitive(element, option, painter, widget);
}
};
Apply it to your app either in your main.cpp or constructor of MainWindow:
QApplication::setStyle(new StyleFixes);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mrg95 |
