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. FlowLayout uses too much height
Forum Updated to NodeBB v4.3 + New Features

FlowLayout uses too much height

Scheduled Pinned Locked Moved Unsolved General and Desktop
flowmingw32desktop
1 Posts 1 Posters 657 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.
  • J Offline
    J Offline
    JoeAB
    wrote on 5 Mar 2018, 21:08 last edited by
    #1

    I am trying to use the FlowLayout sample to create a docked panel with 26 same-size buttons. The buttons are positioned OK and also flow properly when the width of the application is changed.

    However, the height of the panel remains constant and too large. I left these overridden functions as is, except for diagnostics.

    int FlowLayout::heightForWidth(int width) const
    {
    int height = doLayout(QRect(0, 0, width, 0), true);
    qDebug() << "heightForWidth(" << width << ") ht=" << height;
    return height;
    }

    void FlowLayout::setGeometry(const QRect &rect)
    {
    QLayout::setGeometry(rect);
    int height = doLayout(rect, false);
    }

    heightForWidth is only called once, using the width of roughly one button plus margins. The height calculated is for 26 rows (818 pixels), instead or 2 or 3 rows (105 or 136 pixels).

    Is there an easy way to get the FlowLayout to use the calculated height?

    1 Reply Last reply
    0

    1/1

    5 Mar 2018, 21:08

    • Login

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