Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT Designer, How to have Scrolling available for Main Window



  • 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



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


  • Lifetime Qt Champion

    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.



  • 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)



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



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


Log in to reply