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. [SOLVED] Allowing a QVBoxLayout to auto scroll
QtWS25 Last Chance

[SOLVED] Allowing a QVBoxLayout to auto scroll

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 6.4k Views
  • 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.
  • T Offline
    T Offline
    Timmoth
    wrote on 1 Aug 2013, 11:21 last edited by
    #1

    Hi, i have a QVboxLayout which contains a varying amount of buttons.
    when there are too many to fit on screen i would like them to auto scroll using a QScrollArea.

    The QVboxLayout with the buttons in it is inside another QVboxLayout.

    this is what it looks like at the moment:
    http://tinypic.com/r/1zv9y5s/5
    as you can see the buttons actually go off screen.

    could anyone push me in the right direction?

    i did have it working how i wanted using a QWidget but this would show in a window on its own.

    Regards, Tim.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Timmoth
      wrote on 1 Aug 2013, 12:48 last edited by
      #2

      Never mind!
      @QWidget *central = new QWidget;
      QScrollArea *scroll = new QScrollArea;
      QVBoxLayout *g = new QVBoxLayout(central);
      scroll->setWidget(central);
      scroll->setWidgetResizable(true);
      vbox2->addWidget(scroll);@

      then i add my buttons to g

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 1 Aug 2013, 21:40 last edited by
        #3

        Great you found out !

        Could you also update the thread's title to solved ? So other forum users may know that a solution has been found :)

        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
        0
        • T Offline
          T Offline
          Timmoth
          wrote on 1 Aug 2013, 21:43 last edited by
          #4

          yeah, one sec

          1 Reply Last reply
          0

          1/4

          1 Aug 2013, 11:21

          • Login

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