Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to use a QScrollArea

    General and Desktop
    5
    12
    107
    Loading More Posts
    • 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.
    • H
      HenkCoder last edited by

      Hello, I want to put a QScrollArea with an Horizontal ScrollBar but I don't know how to do it.
      Can someone explain it to me?

      Pl45m4 1 Reply Last reply Reply Quote 0
      • Pl45m4
        Pl45m4 @HenkCoder last edited by

        @HenkCoder

        Just add your widget to your scrollArea. The scrollBar should appear automatically.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        H 1 Reply Last reply Reply Quote 0
        • H
          HenkCoder @Pl45m4 last edited by HenkCoder

          @Pl45m4
          d453834a-41ca-4c11-a416-3bc23757bf22-image.png I tried but, no scroll bar and it doesn't resize :/

          Pl45m4 1 Reply Last reply Reply Quote 0
          • Pl45m4
            Pl45m4 @HenkCoder last edited by

            @HenkCoder

            Where is that widget? It looks like a toolBar?
            How you've added your content?


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            H 1 Reply Last reply Reply Quote 0
            • H
              HenkCoder @Pl45m4 last edited by

              @Pl45m4 they are pushbuttons, and I dragged them in the scrollarea

              Pl45m4 1 Reply Last reply Reply Quote 0
              • Pl45m4
                Pl45m4 @HenkCoder last edited by Pl45m4

                @HenkCoder said in How to use a QScrollArea:

                I dragged them in the scrollarea

                Where? In QtDesigner?

                Try setWidget(yourButton)


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                H 1 Reply Last reply Reply Quote 0
                • H
                  HenkCoder @Pl45m4 last edited by

                  @Pl45m4 Nope, in Qt Creator. Ok I'll try.

                  eyllanesc 1 Reply Last reply Reply Quote 0
                  • eyllanesc
                    eyllanesc @HenkCoder last edited by

                    @HenkCoder If you are going to add multiple items then do the following:

                    • Add to QScrollArea.
                    • Place the QPushButton (or other widgets) inside the QScrollArea
                    • Add a layout inside the QScrollArea.

                    If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                    H 1 Reply Last reply Reply Quote 0
                    • H
                      HenkCoder @eyllanesc last edited by

                      @eyllanesc Hey, how do I add a layout inside of it?

                      C 1 Reply Last reply Reply Quote 0
                      • C
                        CEO. @HenkCoder last edited by CEO.

                        @HenkCoder kindly be patient and study about Layout management here.
                        ... https://realpython.com/python-pyqt-layout/

                        Practice the examples, you will understand better.
                        For example:

                        class FirstApp(QWidget):
                                 def__init__(*write your function*)
                        Thereafter, for your scrollarea,
                        
                        grid = QGridLayout()
                        gbox = QGroupBox()
                        gbox.setCheckable(True)
                        vbox = QVBoxLayout()
                        self.setLayout(grid)
                        grid.addWidget(gbox)
                        gbox.setLayout(vbox)
                        
                        surname = QLabel("Surname:")
                        vbox.addWidget(surname)
                        
                        scroll = QSCrollArea()
                        scroll.setVerticalScrollPolicy(...)
                        scroll.setHorizontalScrollPolicy(...)
                        scroll.setResizePolicy(True)
                        scroll.setWidget(gbox)
                        grid.addWidget(scroll)
                        
                        H 1 Reply Last reply Reply Quote 0
                        • H
                          HenkCoder @CEO. last edited by

                          @CEO hey sorry but I'm not using PyQt

                          jsulm 1 Reply Last reply Reply Quote 0
                          • jsulm
                            jsulm Lifetime Qt Champion @HenkCoder last edited by

                            @HenkCoder said in How to use a QScrollArea:

                            sorry but I'm not using PyQt

                            https://doc.qt.io/qt-5/layout.html

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

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post