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. QScrollArea does not create a QScrollBar
Forum Updated to NodeBB v4.3 + New Features

QScrollArea does not create a QScrollBar

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 2 Posters 732 Views 1 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.
  • I Offline
    I Offline
    Iron_Cloud
    wrote on last edited by
    #1

    Hi! i'm trying to have a scrollable area inside a widget. i have a normal widget, empty, called sidebar. i want to place a scrollarea with some buttons in it. When i place the buttons inside the scrollArea, and i apply a layout, it creates a scrollbar for less than a second, but then disappears! therefore, i can't access anything that is not shown because i can't scroll. when i compile it and run the project, it works normally and i can scroll. this is really weird. i am working on Macos (m1).
    Some info:

    QT Creator: 8.0.2

    QT 6.3.2

    Coded in c++

    1 Reply Last reply
    0
    • SGaistS SGaist

      Do you mean Designer with Qt Creator ?

      Qt Design Studio is a different beast.

      I Offline
      I Offline
      Iron_Cloud
      wrote on last edited by
      #13

      @SGaist Solved! Apparently on MacOs it doesn't work until you style it.

      Something like this will work:

      QScrollBar:vertical {
      	border: none;
      	background: transparent;
      	width: 14px;
      	margin: 15px 0 15px 0;
      	border-radius: 0px;
      }
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,

        Don't set a layout on your QScrollArea. Build a widget with these buttons and set the widget on the QScrollArea.

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

        I 1 Reply Last reply
        0
        • SGaistS SGaist moved this topic from Qt Design Studio on
        • SGaistS SGaist

          Hi and welcome to devnet,

          Don't set a layout on your QScrollArea. Build a widget with these buttons and set the widget on the QScrollArea.

          I Offline
          I Offline
          Iron_Cloud
          wrote on last edited by
          #3

          @SGaist thanks for such a quick reply!
          i tried to do it without any layout. it still doesnt work. when i create a qscrollarea it automatically creates a qwidget inside. if i apply the buttons directly to it, it doesnt work, just like the first post i made. if i create another qwidget, and i drag it inside the pre-made qwidget (the default one) it still doesn't work. :(

          SGaistS 1 Reply Last reply
          0
          • I Iron_Cloud

            @SGaist thanks for such a quick reply!
            i tried to do it without any layout. it still doesnt work. when i create a qscrollarea it automatically creates a qwidget inside. if i apply the buttons directly to it, it doesnt work, just like the first post i made. if i create another qwidget, and i drag it inside the pre-made qwidget (the default one) it still doesn't work. :(

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            So you are using Designer to build your widget.

            Apply a layout on the widget. If you just put "floating" buttons, the widget will not expand automatically to fit them all in.

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

            I 1 Reply Last reply
            0
            • SGaistS SGaist

              So you are using Designer to build your widget.

              Apply a layout on the widget. If you just put "floating" buttons, the widget will not expand automatically to fit them all in.

              I Offline
              I Offline
              Iron_Cloud
              wrote on last edited by
              #5

              @SGaist and that is what i did. after i apply the layout, it does put them in order, it shows the scrollbar for like less than a second and then it desappears.

              SGaistS 1 Reply Last reply
              0
              • I Iron_Cloud

                @SGaist and that is what i did. after i apply the layout, it does put them in order, it shows the scrollbar for like less than a second and then it desappears.

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Which OS are you on ?

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

                I 1 Reply Last reply
                0
                • SGaistS SGaist

                  Which OS are you on ?

                  I Offline
                  I Offline
                  Iron_Cloud
                  wrote on last edited by
                  #7

                  @SGaist macos Ventura 13.4.1

                  SGaistS 1 Reply Last reply
                  0
                  • I Iron_Cloud

                    @SGaist macos Ventura 13.4.1

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    Then that's completely normal. By default, on macOS scroll bars don't stay visible unless in use. You can either hover over the region to make them appear and use them or scroll with gestures or mouse central wheel.

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

                    I 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Then that's completely normal. By default, on macOS scroll bars don't stay visible unless in use. You can either hover over the region to make them appear and use them or scroll with gestures or mouse central wheel.

                      I Offline
                      I Offline
                      Iron_Cloud
                      wrote on last edited by
                      #9

                      @SGaist i know that. In fact, it works when i “launch” the program. The thing is, it doesn’t work when i am in design studio. Therefore, without a scrollbar, I can’t add elements that should be visible while scrolling down. As i said, it appears for like half a second, then disappears. I can scroll, drag, ecc and nothing happens.
                      (All of this inside the “edit” in studio design)

                      SGaistS 1 Reply Last reply
                      0
                      • I Iron_Cloud

                        @SGaist i know that. In fact, it works when i “launch” the program. The thing is, it doesn’t work when i am in design studio. Therefore, without a scrollbar, I can’t add elements that should be visible while scrolling down. As i said, it appears for like half a second, then disappears. I can scroll, drag, ecc and nothing happens.
                        (All of this inside the “edit” in studio design)

                        SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        Do you mean Designer with Qt Creator ?

                        Qt Design Studio is a different beast.

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

                        I 3 Replies Last reply
                        0
                        • SGaistS SGaist

                          Do you mean Designer with Qt Creator ?

                          Qt Design Studio is a different beast.

                          I Offline
                          I Offline
                          Iron_Cloud
                          wrote on last edited by
                          #11

                          @SGaist yup, that.

                          1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Do you mean Designer with Qt Creator ?

                            Qt Design Studio is a different beast.

                            I Offline
                            I Offline
                            Iron_Cloud
                            wrote on last edited by
                            #12

                            @SGaist the problem that i have is that i cannot scrool while being in the Design mode of QTcreator. After i place down a scrollArea, place all the stuff inside, and apply a layout, i can see the scrollbar for like half a second, then it disappears. it's really frustrating! i've changed many settings, copied many tutorials and still doesnt work.

                            1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Do you mean Designer with Qt Creator ?

                              Qt Design Studio is a different beast.

                              I Offline
                              I Offline
                              Iron_Cloud
                              wrote on last edited by
                              #13

                              @SGaist Solved! Apparently on MacOs it doesn't work until you style it.

                              Something like this will work:

                              QScrollBar:vertical {
                              	border: none;
                              	background: transparent;
                              	width: 14px;
                              	margin: 15px 0 15px 0;
                              	border-radius: 0px;
                              }
                              1 Reply Last reply
                              0
                              • I Iron_Cloud has marked this topic as solved on
                              • I Iron_Cloud has marked this topic as unsolved on
                              • I Iron_Cloud has marked this topic as solved on

                              • Login

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