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;
|
QPixmap m_labelPixmap;
|
||||||
Utils::FilePath m_baseFileName;
|
Utils::FilePath m_baseFileName;
|
||||||
bool m_readOnly = false;
|
bool m_readOnly = false;
|
||||||
|
bool m_showToolTipOnLabel = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseIntegerAspectPrivate
|
class BaseIntegerAspectPrivate
|
||||||
@@ -176,6 +177,12 @@ void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
|
|||||||
d->m_label->setPixmap(labelPixmap);
|
d->m_label->setPixmap(labelPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseStringAspect::setShowToolTipOnLabel(bool show)
|
||||||
|
{
|
||||||
|
d->m_showToolTipOnLabel = show;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
QString BaseStringAspect::labelText() const
|
QString BaseStringAspect::labelText() const
|
||||||
{
|
{
|
||||||
return d->m_labelText;
|
return d->m_labelText;
|
||||||
@@ -334,8 +341,10 @@ void BaseStringAspect::update()
|
|||||||
d->m_textEditDisplay->setEnabled(enabled);
|
d->m_textEditDisplay->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_labelDisplay)
|
if (d->m_labelDisplay) {
|
||||||
d->m_labelDisplay->setText(displayedString);
|
d->m_labelDisplay->setText(displayedString);
|
||||||
|
d->m_labelDisplay->setToolTip(d->m_showToolTipOnLabel ? displayedString : QString());
|
||||||
|
}
|
||||||
|
|
||||||
if (d->m_label) {
|
if (d->m_label) {
|
||||||
d->m_label->setText(d->m_labelText);
|
d->m_label->setText(d->m_labelText);
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ public:
|
|||||||
QString labelText() const;
|
QString labelText() const;
|
||||||
void setLabelText(const QString &labelText);
|
void setLabelText(const QString &labelText);
|
||||||
void setLabelPixmap(const QPixmap &labelPixmap);
|
void setLabelPixmap(const QPixmap &labelPixmap);
|
||||||
|
void setShowToolTipOnLabel(bool show);
|
||||||
|
|
||||||
void setDisplayFilter(const std::function<QString (const QString &)> &displayFilter);
|
void setDisplayFilter(const std::function<QString (const QString &)> &displayFilter);
|
||||||
void setPlaceHolderText(const QString &placeHolderText);
|
void setPlaceHolderText(const QString &placeHolderText);
|
||||||
|
|||||||
@@ -470,6 +470,7 @@ void ExecutableAspect::setPlaceHolderText(const QString &placeHolderText)
|
|||||||
void ExecutableAspect::setExecutable(const FilePath &executable)
|
void ExecutableAspect::setExecutable(const FilePath &executable)
|
||||||
{
|
{
|
||||||
m_executable.setValue(executable.toString());
|
m_executable.setValue(executable.toString());
|
||||||
|
m_executable.setShowToolTipOnLabel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutableAspect::setSettingsKey(const QString &key)
|
void ExecutableAspect::setSettingsKey(const QString &key)
|
||||||
|
|||||||
Reference in New Issue
Block a user