Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add a label on a layout that covers the entire window.
QtWS25 Last Chance

How to add a label on a layout that covers the entire window.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtdesignerlayoutlogin
9 Posts 3 Posters 5.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ronyNSR Offline
    ronyNSR Offline
    ronyNS
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      One way could be to position/resize your label by hand over the central widget.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ronyNSR Offline
        ronyNSR Offline
        ronyNS
        wrote on last edited by
        #3

        But the layout doesnt let me do that.

        jsulmJ 1 Reply Last reply
        0
        • ronyNSR ronyNS

          But the layout doesnt let me do that.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ronyNS Don't use the layout for this label. Add it to the widget (not to the layout) and position/resize it as needed.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          ronyNSR 1 Reply Last reply
          0
          • jsulmJ jsulm

            @ronyNS Don't use the layout for this label. Add it to the widget (not to the layout) and position/resize it as needed.

            ronyNSR Offline
            ronyNSR Offline
            ronyNS
            wrote on last edited by
            #5

            @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.

            jsulmJ 1 Reply Last reply
            0
            • ronyNSR ronyNS

              @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.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @ronyNS Just pass the central widget as parent to the constructor

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                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.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • ronyNSR Offline
                  ronyNSR Offline
                  ronyNS
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Reimplement the resizeEvent of your main widget and resize your label in there.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved