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. Create a drawer in QWidget
Forum Updated to NodeBB v4.3 + New Features

Create a drawer in QWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 2 Posters 2.0k Views 2 Watching
  • 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.
  • SGaistS SGaist

    Hi,

    Your drawer is typically a widget that is not part of a layout. You position it manually within your main widget and then you should be able to expand it the way you want it.

    S Offline
    S Offline
    saeid0034
    wrote on last edited by
    #3

    @SGaist so I shouldn't use any kind of layout for holding drawer, and position it manually..?
    yeah it could work, but that way I need to handle every resize manually...
    and what about the shadow when the drawer opened?

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

      Full size transparent widget.

      However, what else should be shown on your application ?

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

      S 1 Reply Last reply
      1
      • SGaistS SGaist

        Full size transparent widget.

        However, what else should be shown on your application ?

        S Offline
        S Offline
        saeid0034
        wrote on last edited by
        #5

        @SGaist the ui is as simple as I showed in original post, its just a stacked widget at middle and the drawer beside it

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

          Just thought of QRubberBand

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

          S 1 Reply Last reply
          1
          • SGaistS SGaist

            Just thought of QRubberBand

            S Offline
            S Offline
            saeid0034
            wrote on last edited by
            #7

            @SGaist said in Create a drawer in QWidget:

            Just thought of QRubberBand

            thank you but im not sure how the QRubberBand can help me here

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

              It allows for an easy to use translucent overlay.

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

              S 1 Reply Last reply
              1
              • SGaistS SGaist

                It allows for an easy to use translucent overlay.

                S Offline
                S Offline
                saeid0034
                wrote on last edited by
                #9

                @SGaist said in Create a drawer in QWidget:

                It allows for an easy to use translucent overlay.

                oh yeah, interesting, can we set some kind of layout and widget inside it?

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

                  It's a widget so yes.

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

                  S 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    It's a widget so yes.

                    S Offline
                    S Offline
                    saeid0034
                    wrote on last edited by
                    #11

                    @SGaist let me bring this old topic up, I wanted to try and use QRubberband as what I wanted, the drawing is simple as you said, but Im not sure how can I use it as an widget... can you help me a little?
                    thank you.

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

                      Well, it is a widget, so you can do with it the same things a with a QWidget.

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

                      S 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        Well, it is a widget, so you can do with it the same things a with a QWidget.

                        S Offline
                        S Offline
                        saeid0034
                        wrote on last edited by saeid0034
                        #13

                        @SGaist oh ok, but tbh I can't see how it would be better, because mostly I need to do the same thing that I have to do in QFrame in QRubberBand too...
                        for example if I want to do it with A QFrame the steps would be

                        1- create a Frame but dont put it in any layout
                        2- manually set its position
                        3- handle resize event on it, so its resize with the gui

                        what I think is good way for it is, creating a empty frame as a placeholder (why? see the concept in first post)
                        then use that to move and resize the layoutless widget, and done.
                        the only problem that I currently have is how to resize the layoutless widget with animation, I mean if I want to use the normal way (I mean creating a QPropertyAnimation with Drawer as parent and minimumWidth as propertyName) it will only work when I want to expand the drawer, not the other way...

                        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