Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to set real estate between two component in VboxLayout (solved)
Forum Updated to NodeBB v4.3 + New Features

How to set real estate between two component in VboxLayout (solved)

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 693 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    In VBoxLayout, how to set the real estate between two component?
    like 80% and 20%? instead of 50%-50%?

    QVBoxLayout *vbox=new QVBoxLayout(this);
    vbox->addWidget(lineEdit);
    vbox->addWidget(pTicker);
    setLayout(vbox);
    
    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      Set a "stretch factor":http://qt-project.org/doc/qt-5/layout.html#stretch-factors for each of your widgets

      You can do that using QBoxLayout::insertWidget() or QBoxLayout::setStretchFactor(). See http://qt-project.org/doc/qt-5/qboxlayout.html for detailed documentation for those functions.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      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