View Full Version : Remove Borders around a QLabel
riarioriu3
13th July 2012, 10:51
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.
tferreira
13th July 2012, 11:13
You can define a stylesheet for the label:
label->setStyleSheet("border: 0px;");
or for the parent QWidget:
this->setStyleSheet("QLabel { border: 0px; }");
More about that, here: http://qt-project.org/doc/qt-4.8/stylesheet-examples.html
riarioriu3
13th July 2012, 11:25
I have tried the above one , but it does not have any impact ..
Could you please give any other method ?
sonulohani
13th July 2012, 11:32
it may work.
label->setContentsMargins(0, 0, 0, 0);
riarioriu3
13th July 2012, 11:59
i got the solution
we can do this with Style sheets. we probably have a line like this Application app(argc, argv);
underneath that, add one like this: app.setStyleSheet("QStatusBar::item { border: 0px solid black }; ");
and those pesky boxes will be gone.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.