Viku
Viku

Reputation: 2973

Remove Borders around a QLabel in Qt

I have added one qlabel in my application's statusbar . And now I have been trying to remove the borders around the QLabel.

label->setFrameShape(QFrame::HLine);
label->setFrameStyle(QFrame::NoFrame);
// label->setLineWidth(0);
//label->setMidLineWidth(0);

I tried everything above, none of them work, any help is appreciated.

Upvotes: 2

Views: 2424

Answers (1)

Viku
Viku

Reputation: 2973

We can do this with style sheets. Where you declare your QApplication app variable add underneath a line like this:

QApplication app(argc, argv);
app.setStyleSheet("QStatusBar::item { border: 0px solid black }; ");

and those pesky boxes will be gone.

Upvotes: 5

Related Questions