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. heightForWidth() doesn't work after child call setLayout()
Forum Updated to NodeBB v4.3 + New Features

heightForWidth() doesn't work after child call setLayout()

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

    I have overwrite heightForWidth().But when I call the setLayout, the heightForWidth cannot work.
    PhoneWidget.cpp
    PhoneWidget::PhoneWidget(QWidget *parent) : QWidget(parent)
    {
    m_phoneHeader = new PhoneHeader(this);
    m_phoneFooter = new PhoneFooter(this);
    m_touchScreen = new TouchScreen(this);
    m_touchScreen->setMinimumSize(1, 1);
    QBoxLayout *layout = new QVBoxLayout();
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addWidget(m_phoneHeader);
    layout->addWidget(m_touchScreen);
    layout->addWidget(m_phoneFooter);
    setLayout(layout);
    QSizePolicy p(sizePolicy());
    p.setHeightForWidth(true);
    setSizePolicy(p);
    }

    TopWidget.cpp:
    QBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->addWidget(m_leftToolBox);
    mainLayout->addWidget(m_phoneWidget);
    mainLayout->addWidget(m_rightToolBox);
    setLayout(mainLayout);

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      is your heightForWidth() called ?
      Maybe related to
      http://stackoverflow.com/questions/17708449/qwidgetheightforwidth-is-not-called

      What platform and Qt version?

      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