Label text overlap another label text when both the labels at the same position
-
Hi ,
i have created the QLabel on the container(QFrame) at a position. after that i have created the another container(QFrame) with the Qlabel at the same location.
I found that the label text of first container overlap with label on second container while showing application.i tried to set the setAutoFillBackground(true) but did not work.
-
You should provide some minimal working code for us to better understand the problem.
-
From your description it looks to me that you are not using the layout for positioning. Use layout and it will not overlap. Also if you give sample code we can give you quick example as well.
-
[quote author="yhodage" date="1389618743"]
i have created the QLabel on the container(QFrame) at a position. after that i have created the another container(QFrame) with the Qlabel at the same location.
I found that the label text of first container overlap with label on second container while showing application.i tried to set the setAutoFillBackground(true) but did not work.[/quote]
you should use QStackedWidget for such a purpose.
But if you want to do the positioning manually you need to set the background:With stylesheets:
@
myLabel->setStylesheet("QLabel { background: gray; }"
@With QPalette:
@
QPalette palette = myLabel->palette();
palette.setBrush(QPalette::Window, QPalette().brush(QPalette::Window));
myLabel->setAutofillBackground(true);
myLabel->setPalette(palette);
@