forked from qt-creator/qt-creator
CMake: Use eliding label instead of manually eliding text
This fixes the kit options page becoming wider in some cases as the eliding was apparently off. Change-Id: Ia682b75a2441d8d265b7c5a3c9943e36f33167db Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/elidinglabel.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QBoxLayout>
|
||||
@@ -278,7 +279,7 @@ QString CMakeGeneratorKitConfigWidget::toolTip() const
|
||||
CMakeConfigurationKitConfigWidget::CMakeConfigurationKitConfigWidget(Kit *kit,
|
||||
const KitInformation *ki) :
|
||||
KitConfigWidget(kit, ki),
|
||||
m_summaryLabel(new QLabel),
|
||||
m_summaryLabel(new Utils::ElidingLabel),
|
||||
m_manageButton(new QPushButton)
|
||||
{
|
||||
refresh();
|
||||
@@ -303,13 +304,9 @@ void CMakeConfigurationKitConfigWidget::refresh()
|
||||
{
|
||||
const QStringList current = CMakeConfigurationKitInformation::toStringList(kit());
|
||||
|
||||
QString shortSummary = current.join(QLatin1String("; "));
|
||||
QFontMetrics fm(m_summaryLabel->font());
|
||||
shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_summaryLabel->width());
|
||||
m_summaryLabel->setText(current.isEmpty() ? tr("<No Changes to Apply>") : shortSummary);
|
||||
|
||||
m_summaryLabel->setText(current.join("; "));
|
||||
if (m_editor)
|
||||
m_editor->setPlainText(current.join(QLatin1Char('\n')));
|
||||
m_editor->setPlainText(current.join('\n'));
|
||||
}
|
||||
|
||||
QWidget *CMakeConfigurationKitConfigWidget::mainWidget() const
|
||||
|
||||
Reference in New Issue
Block a user