Skip to content

Commit

Permalink
Merge pull request #7846 from spycrab/qt_no_ticks
Browse files Browse the repository at this point in the history
Qt/MappingButton: Don't show ticks
  • Loading branch information
spycrab committed Mar 4, 2019
2 parents 66a8220 + 386accd commit 13b2b93
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp
Expand Up @@ -33,9 +33,11 @@

constexpr int SLIDER_TICK_COUNT = 100;

static QString EscapeAmpersand(QString&& string)
// Escape ampersands and remove ticks
static QString ToDisplayString(QString&& string)
{
return string.replace(QStringLiteral("&"), QStringLiteral("&&"));
return string.replace(QStringLiteral("&"), QStringLiteral("&&"))
.replace(QStringLiteral("`"), QStringLiteral(""));
}

bool MappingButton::IsInput() const
Expand All @@ -44,7 +46,7 @@ bool MappingButton::IsInput() const
}

MappingButton::MappingButton(MappingWidget* widget, ControlReference* ref, bool indicator)
: ElidedButton(EscapeAmpersand(QString::fromStdString(ref->GetExpression()))), m_parent(widget),
: ElidedButton(ToDisplayString(QString::fromStdString(ref->GetExpression()))), m_parent(widget),
m_reference(ref)
{
// Force all mapping buttons to stay at a minimal height.
Expand Down Expand Up @@ -190,7 +192,7 @@ void MappingButton::Detect()

void MappingButton::OnButtonTimeout()
{
setText(EscapeAmpersand(QString::fromStdString(m_reference->GetExpression())));
setText(ToDisplayString(QString::fromStdString(m_reference->GetExpression())));
}

void MappingButton::Clear()
Expand All @@ -206,7 +208,7 @@ void MappingButton::Update()
const auto lock = ControllerEmu::EmulatedController::GetStateLock();
m_reference->UpdateReference(g_controller_interface,
m_parent->GetController()->GetDefaultDevice());
setText(EscapeAmpersand(QString::fromStdString(m_reference->GetExpression())));
setText(ToDisplayString(QString::fromStdString(m_reference->GetExpression())));
}

void MappingButton::mouseReleaseEvent(QMouseEvent* event)
Expand Down

0 comments on commit 13b2b93

Please sign in to comment.