diff options
author | Andy Shaw <andy.shaw@theqtcompany.com> | 2016-05-23 12:26:32 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2016-07-01 11:16:31 +0000 |
commit | e3d66feaa79cfb77025b624d0b59ad8037362b1e (patch) | |
tree | dfe40f5eca8cc5d63927520027abe309f78920fc | |
parent | 5d00208c1c1b1563e8b52c4f18a69ab66d0da724 (diff) | |
download | qttools-e3d66feaa79cfb77025b624d0b59ad8037362b1e.tar.gz |
Use the size hint of the pushbutton when determining the minimum height
Since the pushbutton has not been shown at the time the height of it is
requested then it has a default which is bigger than it will ultimately
be. Therefore to ensure the layout is setup correctly we depend on the
sizeHint() instead to give the right height for the button.
Task-number: QTBUG-52020
Change-Id: I569bfbc59671e682c83e98d38199aca69c6b768f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r-- | src/linguist/linguist/messageeditorwidgets.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/linguist/linguist/messageeditorwidgets.cpp b/src/linguist/linguist/messageeditorwidgets.cpp index 0b4a6ec87..acee5a87f 100644 --- a/src/linguist/linguist/messageeditorwidgets.cpp +++ b/src/linguist/linguist/messageeditorwidgets.cpp @@ -339,17 +339,18 @@ void FormMultiWidget::updateLayout() layoutForPlusButtons->setMargin(0); for (int i = 0; i < m_plusButtons.count(); ++i) layoutForPlusButtons->addWidget(m_plusButtons.at(i), Qt::AlignTop); - layout->addLayout(layoutForPlusButtons, 1, 0); + layout->addLayout(layoutForPlusButtons, 1, 0, Qt::AlignTop); + const int minimumRowHeight = m_plusButtons.at(0)->sizeHint().height() / 2.0; QGridLayout *layoutForLabels = new QGridLayout; layoutForLabels->setMargin(0); - layoutForLabels->setRowMinimumHeight(0, m_plusButtons.at(0)->height()/2.0); + layoutForLabels->setRowMinimumHeight(0, minimumRowHeight); for (int j = 0; j < m_editors.count(); ++j) { layoutForLabels->addWidget(m_editors.at(j), 1 + j, 0, Qt::AlignVCenter); layoutForLabels->addWidget(m_minusButtons.at(j), 1 + j, 1, Qt::AlignVCenter); } - layoutForLabels->setRowMinimumHeight(m_editors.count() + 1, m_plusButtons.at(0)->height()/2.0); - layout->addLayout(layoutForLabels, 1, 1); + layoutForLabels->setRowMinimumHeight(m_editors.count() + 1, minimumRowHeight); + layout->addLayout(layoutForLabels, 1, 1, Qt::AlignTop); } else { for (int k = 0; k < m_editors.count(); ++k) layout->addWidget(m_editors.at(k), 1 + k, 0, Qt::AlignVCenter); |