Revert "Utils: Remove the text option for LayoutItem"

This reverts commit 5154e1eb02.

For some yet unknown reason, this renders the whole sublayout read-only.

Change-Id: Ide1587382392a57643bed1b3cdd7d8987dbdab57
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-09-28 14:27:56 +02:00
parent a5026d7a2f
commit bc4e76f76b
2 changed files with 7 additions and 9 deletions

View File

@@ -31,7 +31,6 @@
#include <QFormLayout>
#include <QGridLayout>
#include <QLabel>
#include <QWidget>
namespace Utils {
@@ -97,12 +96,7 @@ LayoutBuilder::LayoutItem::LayoutItem(BaseAspect *aspect)
/*!
Constructs a layout item containing some static \a text.
*/
LayoutBuilder::LayoutItem::LayoutItem(const QString &text)
{
auto label = new QLabel(text);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
widget = label;
}
LayoutBuilder::LayoutItem::LayoutItem(const QString &text) : text(text) {}
/*!
\class Utils::LayoutBuilder
@@ -241,7 +235,10 @@ void LayoutBuilder::flushPendingFormItems()
else if (auto widget = m_pendingFormItems.at(1).widget)
m_formLayout->addRow(label, widget);
} else {
QTC_CHECK(false);
if (auto layout = m_pendingFormItems.at(1).layout)
m_formLayout->addRow(m_pendingFormItems.at(0).text, layout);
else if (auto widget = m_pendingFormItems.at(1).widget)
m_formLayout->addRow(m_pendingFormItems.at(0).text, widget);
}
} else {
QTC_CHECK(false);

View File

@@ -62,6 +62,7 @@ public:
QLayout *layout = nullptr;
QWidget *widget = nullptr;
BaseAspect *aspect = nullptr;
QString text;
int span = 1;
Qt::Alignment align;
};