forked from qt-creator/qt-creator
ProjectExplorer: Add tool tip to ExecutableAspect
Because our project mode uses a fixed width for some reason, the file path of an executable often does not fit on its label. Add a tool tip to work around this. Fixes: QTCREATORBUG-18991 Change-Id: I4ab7cd8812ae15bcef95c16a862361e24a28c259 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -94,6 +94,7 @@ public:
|
||||
QPixmap m_labelPixmap;
|
||||
Utils::FilePath m_baseFileName;
|
||||
bool m_readOnly = false;
|
||||
bool m_showToolTipOnLabel = false;
|
||||
};
|
||||
|
||||
class BaseIntegerAspectPrivate
|
||||
@@ -176,6 +177,12 @@ void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
|
||||
d->m_label->setPixmap(labelPixmap);
|
||||
}
|
||||
|
||||
void BaseStringAspect::setShowToolTipOnLabel(bool show)
|
||||
{
|
||||
d->m_showToolTipOnLabel = show;
|
||||
update();
|
||||
}
|
||||
|
||||
QString BaseStringAspect::labelText() const
|
||||
{
|
||||
return d->m_labelText;
|
||||
@@ -334,8 +341,10 @@ void BaseStringAspect::update()
|
||||
d->m_textEditDisplay->setEnabled(enabled);
|
||||
}
|
||||
|
||||
if (d->m_labelDisplay)
|
||||
if (d->m_labelDisplay) {
|
||||
d->m_labelDisplay->setText(displayedString);
|
||||
d->m_labelDisplay->setToolTip(d->m_showToolTipOnLabel ? displayedString : QString());
|
||||
}
|
||||
|
||||
if (d->m_label) {
|
||||
d->m_label->setText(d->m_labelText);
|
||||
|
||||
Reference in New Issue
Block a user