How to add a label on a layout that covers the entire window.
-
wrote on 7 Aug 2016, 18:27 last edited by
Hello,
I am trying to create a sliding window for my main login page i.e i have created a simple login page with a layout and i want to add a label on top of the login page which will cover the login page . It is more like a welcome page . The welcome page will slide up and the login page will be seen.So i have placed all the widgets on the central widget for the login page using a layout.
Now the problem is when i try to add a label that covers the entire window, the layout wont let me do that , also if i set the size policy to fix and change the size , it changes the size of the entire window. Is there a way i can add the label on the layout but without affecting the present layout . I tried MainWindow :: setCentralWidget() , but that stops me from doing the sliding animation.Also if anybody know any other easy way by which i can achieve what i'm trying to do , please tell me.
I Just want a simple welcome page that slides up on clicking a button.
Thank youqrt -
Hi,
One way could be to position/resize your label by hand over the central widget.
-
wrote on 8 Aug 2016, 01:27 last edited by
But the layout doesnt let me do that.
-
@ronyNS Don't use the layout for this label. Add it to the widget (not to the layout) and position/resize it as needed.
-
@ronyNS Don't use the layout for this label. Add it to the widget (not to the layout) and position/resize it as needed.
wrote on 8 Aug 2016, 10:44 last edited by@jsulm How to add to a widget. Sorry im a beginner. The addwidget() function can be only used with a layout so if you are telling me to add without a layout i cannot use that function. If i drag the label on the ui it moves all the widgets. I cant find a way to add the entire label on top of the layout.
-
@jsulm How to add to a widget. Sorry im a beginner. The addwidget() function can be only used with a layout so if you are telling me to add without a layout i cannot use that function. If i drag the label on the ui it moves all the widgets. I cant find a way to add the entire label on top of the layout.
@ronyNS Just pass the central widget as parent to the constructor
-
What @jsulm and I are suggesting is that you don't put that label in any layout. Handle it by hand both for size and position.
-
wrote on 8 Aug 2016, 17:18 last edited by
I understand what you are trying to say. But i dont know how to do that. Should i use setGeometry() or something else. How should i resize it.
-
Reimplement the resizeEvent of your main widget and resize your label in there.
9/9