Skip to content
Permalink
Browse files

Merge pull request #8450 from jordan-woyak/mapping-button-fix

DolphinQt: Fix output mapping button spacebar activation and tooltip.
  • Loading branch information...
stenzek committed Nov 8, 2019
2 parents b554b63 + 32cf4b7 commit 7c8a255ce1267e41368e31e5adebfb6f7db4c2a2
@@ -53,10 +53,17 @@ MappingButton::MappingButton(MappingWidget* parent, ControlReference* ref, bool

setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

setToolTip(
tr("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
if (IsInput())
{
setToolTip(
tr("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
}
else
{
setToolTip(tr("Left/Right-click to configure output.\nMiddle-click to clear."));
}

connect(this, &MappingButton::clicked, this, &MappingButton::Detect);
connect(this, &MappingButton::clicked, this, &MappingButton::Clicked);

if (indicator)
connect(parent, &MappingWidget::Update, this, &MappingButton::UpdateIndicator);
@@ -74,10 +81,13 @@ void MappingButton::AdvancedPressed()
m_parent->SaveSettings();
}

void MappingButton::Detect()
void MappingButton::Clicked()
{
if (!m_reference->IsInput())
{
AdvancedPressed();
return;
}

const auto default_device_qualifier = m_parent->GetController()->GetDefaultDevice();

@@ -141,19 +151,14 @@ void MappingButton::mouseReleaseEvent(QMouseEvent* event)
{
switch (event->button())
{
case Qt::MouseButton::LeftButton:
if (m_reference->IsInput())
QPushButton::mouseReleaseEvent(event);
else
AdvancedPressed();
return;
case Qt::MouseButton::MidButton:
Clear();
return;
case Qt::MouseButton::RightButton:
AdvancedPressed();
return;
default:
QPushButton::mouseReleaseEvent(event);
return;
}
}
@@ -18,7 +18,6 @@ class MappingButton : public ElidedButton
public:
MappingButton(MappingWidget* widget, ControlReference* ref, bool indicator);

void Detect();
bool IsInput() const;

private:
@@ -27,6 +26,7 @@ class MappingButton : public ElidedButton
void ConfigChanged();
void AdvancedPressed();

void Clicked();
void mouseReleaseEvent(QMouseEvent* event) override;

MappingWidget* m_parent;

0 comments on commit 7c8a255

Please sign in to comment.
You can’t perform that action at this time.