diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2019-11-21 15:35:24 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2019-11-21 17:04:32 +0000 |
commit | e53e0a808b5d0075c95fd7635ce53cc4de277f3a (patch) | |
tree | 5ff01954827579d57c1584aa33145ddb3592f43d | |
parent | b6ed781c2838b6733c85950f5e06d099b7c68eb6 (diff) | |
download | qt-creator-e53e0a808b5d0075c95fd7635ce53cc4de277f3a.tar.gz |
ProjectExplorer: Use Utils::ElidingLabel in EnvironmentKitAspectWidget
Utils: :ElidingLabel re-elides on resize.
Change-Id: I62709da60e7ab0156a33f373b236f71d1795d48f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/projectexplorer/kitinformation.cpp | 9 |
1 files 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 <coreplugin/variablechooser.h> #include <ssh/sshconnection.h> #include <utils/algorithm.h> +#include <utils/elidinglabel.h> #include <utils/environment.h> #include <utils/environmentdialog.h> #include <utils/macroexpander.h> @@ -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; |