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.
  • R Offline
    R Offline
    ronyNS
    wrote on 7 Aug 2016, 18:27 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 7 Aug 2016, 19:34 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
      • R Offline
        R Offline
        ronyNS
        wrote on 8 Aug 2016, 01:27 last edited by
        #3

        But the layout doesnt let me do that.

        J 1 Reply Last reply 8 Aug 2016, 04:25
        0
        • R ronyNS
          8 Aug 2016, 01:27

          But the layout doesnt let me do that.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 8 Aug 2016, 04:25 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

          R 1 Reply Last reply 8 Aug 2016, 10:44
          0
          • J jsulm
            8 Aug 2016, 04:25

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

            R Offline
            R Offline
            ronyNS
            wrote on 8 Aug 2016, 10:44 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.

            J 1 Reply Last reply 8 Aug 2016, 10:48
            0
            • R ronyNS
              8 Aug 2016, 10:44

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

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 8 Aug 2016, 10:48 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
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 8 Aug 2016, 10:48 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
                • R Offline
                  R Offline
                  ronyNS
                  wrote on 8 Aug 2016, 17:18 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
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 8 Aug 2016, 20:56 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

                    9/9

                    8 Aug 2016, 20:56

                    • Login

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