mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-10 08:24:32 +00:00
Qt: Include full binding text in tooltip
This commit is contained in:
@@ -83,17 +83,18 @@ void InputBindingWidget::updateText()
|
||||
else
|
||||
{
|
||||
QString binding_text(QString::fromStdString(m_bindings[0]));
|
||||
setToolTip(binding_text);
|
||||
|
||||
// fix up accelerators, and if it's too long, ellipsise it
|
||||
// fix up accelerators
|
||||
if (binding_text.contains('&'))
|
||||
binding_text = binding_text.replace(QStringLiteral("&"), QStringLiteral("&&"));
|
||||
|
||||
setToolTip(QStringLiteral("%1\n\n%2\n%3").arg(binding_text).arg(tr(help_text)).arg(tr(help_clear_text)));
|
||||
|
||||
// if it's too long, ellipsise it
|
||||
const int max_length = (width() < 300) ? 35 : 60;
|
||||
if (binding_text.length() > max_length)
|
||||
binding_text = binding_text.left(max_length).append(QStringLiteral("..."));
|
||||
setText(binding_text);
|
||||
setToolTip(QStringLiteral("%1\n\n%2\n%3").arg(binding_text).arg(tr(help_text)).arg(tr(help_clear_text)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user