From e53e0a808b5d0075c95fd7635ce53cc4de277f3a Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 21 Nov 2019 15:35:24 +0100 Subject: ProjectExplorer: Use Utils::ElidingLabel in EnvironmentKitAspectWidget Utils: :ElidingLabel re-elides on resize. Change-Id: I62709da60e7ab0156a33f373b236f71d1795d48f Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/kitinformation.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index d3c14a0250..500dd7d705 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1129,7 +1130,7 @@ class EnvironmentKitAspectWidget : public KitAspectWidget public: EnvironmentKitAspectWidget(Kit *workingCopy, const KitAspect *ki) : KitAspectWidget(workingCopy, ki), - m_summaryLabel(new QLabel), + m_summaryLabel(new Utils::ElidingLabel), m_manageButton(new QPushButton), m_mainWidget(new QWidget) { @@ -1153,9 +1154,7 @@ private: void refresh() override { const Utils::EnvironmentItems changes = currentEnvironment(); - QString shortSummary = Utils::EnvironmentItem::toStringList(changes).join(QLatin1String("; ")); - QFontMetrics fm(m_summaryLabel->font()); - shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_summaryLabel->width()); + const QString shortSummary = Utils::EnvironmentItem::toStringList(changes).join("; "); m_summaryLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary); } @@ -1216,7 +1215,7 @@ private: }); } - QLabel *m_summaryLabel; + Utils::ElidingLabel *m_summaryLabel; QPushButton *m_manageButton; QCheckBox *m_vslangCheckbox; QWidget *m_mainWidget; -- cgit v1.2.1