Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QT Designer, How to have Scrolling available for Main Window
Forum Updated to NodeBB v4.3 + New Features

QT Designer, How to have Scrolling available for Main Window

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
9 Posts 4 Posters 6.2k 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.
  • R Offline
    R Offline
    rindi
    wrote on last edited by rindi
    #1

    Hi,
    I can't seem to figure this out. I'm trying to create a form that has several large Push buttons that users can click on to select things. On some Notebook PC's with low Display resolutions it can happen that the window won't fit on the screen and not all buttons are visible. What I want to happen in this situation is that the User can resize the Window so it fits on the Display, and that the Window gets Scrollbars so he can scroll to those buttons he can't see.

    In my point of view that should be how all Windows behave by default. If a window is large enough to display everything within it, no scrollbars, if it is resized so it is too small to display all it's contents, the scrollbars should appear.

    I have tried using a Scroll area, added a layout to which I added the buttons, but when I use "Form, Preview in, Windows Style" and then resize the resulting Window, no Scrollbars appear and not all buttons are visible. If I set the Scrollbar properties to always be visible, they are shown, but they don't have any function.

    Can anyone explain to me how to get this working?

    I'm running the designer on Debian Testing...

    Thanks for all help,
    rindi

    1 Reply Last reply
    0
    • R rindi

      Thanks for your answer, but I believe that is more or less what I tried, but maybe I haven't understood properly. Anyway, I'm attaching a screenshot of my Object Inspector, maybe that will show where I have made my mistakes.
      ![alt text](Object-Inspector-A.png image url)

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #4

      @rindi
      One thing: in your pic, each one of those "red no-entry" signs on your widgets indicates that you have not set a layout on the widget. And that can make things not right, even if this is not directly related to your issue. You should be able to right-click on those widgets --- either in this tree view or on the actual widget --- and select the Lay out entry to assign a layout to the widget. I would get all those done to see if it affects your problem.

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

        Hi and welcome to devnet,

        From your description you have the following issue: you are trying to layout stuff on QScrollArea.

        What you should do is create a QWidget, set a layout on it, put your buttons and the rest in that layout and then set that 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

        1 Reply Last reply
        1
        • R Offline
          R Offline
          rindi
          wrote on last edited by
          #3

          Thanks for your answer, but I believe that is more or less what I tried, but maybe I haven't understood properly. Anyway, I'm attaching a screenshot of my Object Inspector, maybe that will show where I have made my mistakes.
          ![alt text](Object-Inspector-A.png image url)

          JonBJ 1 Reply Last reply
          0
          • R rindi

            Thanks for your answer, but I believe that is more or less what I tried, but maybe I haven't understood properly. Anyway, I'm attaching a screenshot of my Object Inspector, maybe that will show where I have made my mistakes.
            ![alt text](Object-Inspector-A.png image url)

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @rindi
            One thing: in your pic, each one of those "red no-entry" signs on your widgets indicates that you have not set a layout on the widget. And that can make things not right, even if this is not directly related to your issue. You should be able to right-click on those widgets --- either in this tree view or on the actual widget --- and select the Lay out entry to assign a layout to the widget. I would get all those done to see if it affects your problem.

            C 1 Reply Last reply
            1
            • R Offline
              R Offline
              rindi
              wrote on last edited by
              #5

              @JonB
              Thanks a lot, that has fixed it.
              Cheers,
              rindi

              1 Reply Last reply
              0
              • JonBJ JonB

                @rindi
                One thing: in your pic, each one of those "red no-entry" signs on your widgets indicates that you have not set a layout on the widget. And that can make things not right, even if this is not directly related to your issue. You should be able to right-click on those widgets --- either in this tree view or on the actual widget --- and select the Lay out entry to assign a layout to the widget. I would get all those done to see if it affects your problem.

                C Offline
                C Offline
                Calvin H-C
                wrote on last edited by Calvin H-C
                #6

                @JonB said in QT Designer, How to have Scrolling available for Main Window:

                One thing: in your pic, each one of those "red no-entry" signs on your widgets indicates that you have not set a layout on the widget. And that can make things not right, even if this is not directly related to your issue. You should be able to right-click on those widgets --- either in this tree view or on the actual widget --- and select the Lay out entry to assign a layout to the widget.

                What if there is only one child in the widget without a layout? The "red no-entry" sign shows, but when you right-click on such a widget and select Layout, everything is greyed out.

                JonBJ 1 Reply Last reply
                0
                • C Calvin H-C

                  @JonB said in QT Designer, How to have Scrolling available for Main Window:

                  One thing: in your pic, each one of those "red no-entry" signs on your widgets indicates that you have not set a layout on the widget. And that can make things not right, even if this is not directly related to your issue. You should be able to right-click on those widgets --- either in this tree view or on the actual widget --- and select the Lay out entry to assign a layout to the widget.

                  What if there is only one child in the widget without a layout? The "red no-entry" sign shows, but when you right-click on such a widget and select Layout, everything is greyed out.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #7

                  @Calvin-H-C
                  That post was made 4 years ago! It's not 100% clear what you mean, but Designer has an unintuitive way of working if this is your case: if a widget has no children you cannot put a layout on it, it's greyed out. You have to add at least one child widget on the container widget, then you will be able to select a layout. You can even delete the child widget after that and leave the parent with a layout, you just have to have a child there in order to select a layout.

                  C 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @Calvin-H-C
                    That post was made 4 years ago! It's not 100% clear what you mean, but Designer has an unintuitive way of working if this is your case: if a widget has no children you cannot put a layout on it, it's greyed out. You have to add at least one child widget on the container widget, then you will be able to select a layout. You can even delete the child widget after that and leave the parent with a layout, you just have to have a child there in order to select a layout.

                    C Offline
                    C Offline
                    Calvin H-C
                    wrote on last edited by Calvin H-C
                    #8

                    @JonB I know it was an old thread, but the situation was what I was having with a QScrollView as a child to a central widget having a child that is a widget with scroll bars not showing.

                    When I tried adding a layout, all choices were greyed out. I recall reading somewhere that there must be at least TWO children to add a layout, which was what I was seeing. Your mentioning that it was possible to delete a child after adding a layout gave me an idea.

                    I added a second child and the choices for adding a layout were no longer greyed out, so I selected a layout and then deleted the unneeded child. That worked.

                    My problem is that with all the red circles gone, the scroll bars still don't work.

                    JonBJ 1 Reply Last reply
                    0
                    • C Calvin H-C

                      @JonB I know it was an old thread, but the situation was what I was having with a QScrollView as a child to a central widget having a child that is a widget with scroll bars not showing.

                      When I tried adding a layout, all choices were greyed out. I recall reading somewhere that there must be at least TWO children to add a layout, which was what I was seeing. Your mentioning that it was possible to delete a child after adding a layout gave me an idea.

                      I added a second child and the choices for adding a layout were no longer greyed out, so I selected a layout and then deleted the unneeded child. That worked.

                      My problem is that with all the red circles gone, the scroll bars still don't work.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #9

                      @Calvin-H-C
                      There has been no QScrollView since Qt3. I have not heard of requiring two children for adding a layout, but there you are. Not everything needs a layout --- containers like QScrollArea do not, I don't think you should put one on them, and should not show the "no entry" sign without one. For scrolling issues I know that QScrollArea has a widgetResizable which often needs setting to true for scrolling/scrollbars to work right. Otherwise show a screenshot from Designer and paste (a minimal) .ui file and someone will doubtless comment.

                      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