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. Resize QScrollArea to fit content
Forum Updated to NodeBB v4.3 + New Features

Resize QScrollArea to fit content

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 5.8k 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.
  • S Offline
    S Offline
    strangelookingnerd
    wrote on last edited by
    #1

    Hello!

    I got a QWidget inside a QScrollArea (see below)

    @void Ui_Manager::setupUi(QWidget *manager)
    {
    QScrollArea *scrollArea = new QScrollArea();
    scrollArea->setWidget(manager);
    scrollArea->setWidgetResizable(true);
    }@

    During Runtime i add several other Widgets to the Manager and move them into free space available inside the Manager-Widget:

    @void addWidgets(QWidget *ptr, QPoint pos)
    {
    ptr->setParent(this);
    ptr->move(pos);
    ptr->show();
    }@

    So it may happen, that the added Widgets were moved outside of the visible region of the Manager when there is not enough space available - thats the point where i hoped for the ScrollArea to take control and give me some nice ScrollBars to access the "hidden" Widgets. But it won't show me any ScrollBars and i don't have any idea why or how to change this.
    This problem bothers me for a while now and i hope for someone here to give me a little hint :)

    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      strangelookingnerd
      wrote on last edited by
      #2

      Addition:

      Just tried to add a Layout to the Manager and added the widgets to the Layout which made the Scrollbar work like a charm. But i can't use a Layout bcs I'm using drag&drop to move the added Widgets and using a Layout would overwrite positions of the widgets when the Manager-Window is resized.
      This makes me even more confused :/

      Someone help me fix this please!

      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