forked from qt-creator/qt-creator
Utils: Remove the text option for LayoutItem
This is converted to QLabels on the Qt side anyway, so we can can just do that and avoid the special casing later for form layouts later and gain the functionality for grids. Use the opportunity to make the all mouse-selectable. Change-Id: I37830b028b8d2987ea4925f364c79e905be725c8 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
#include <QLabel>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
@@ -96,7 +97,12 @@ LayoutBuilder::LayoutItem::LayoutItem(BaseAspect *aspect)
|
|||||||
/*!
|
/*!
|
||||||
Constructs a layout item containing some static \a text.
|
Constructs a layout item containing some static \a text.
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(const QString &text) : text(text) {}
|
LayoutBuilder::LayoutItem::LayoutItem(const QString &text)
|
||||||
|
{
|
||||||
|
auto label = new QLabel(text);
|
||||||
|
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
widget = label;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Utils::LayoutBuilder
|
\class Utils::LayoutBuilder
|
||||||
@@ -235,10 +241,7 @@ void LayoutBuilder::flushPendingFormItems()
|
|||||||
else if (auto widget = m_pendingFormItems.at(1).widget)
|
else if (auto widget = m_pendingFormItems.at(1).widget)
|
||||||
m_formLayout->addRow(label, widget);
|
m_formLayout->addRow(label, widget);
|
||||||
} else {
|
} else {
|
||||||
if (auto layout = m_pendingFormItems.at(1).layout)
|
QTC_CHECK(false);
|
||||||
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 {
|
} else {
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
|
@@ -62,7 +62,6 @@ public:
|
|||||||
QLayout *layout = nullptr;
|
QLayout *layout = nullptr;
|
||||||
QWidget *widget = nullptr;
|
QWidget *widget = nullptr;
|
||||||
BaseAspect *aspect = nullptr;
|
BaseAspect *aspect = nullptr;
|
||||||
QString text;
|
|
||||||
int span = 1;
|
int span = 1;
|
||||||
Qt::Alignment align;
|
Qt::Alignment align;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user