mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 08:49:20 +01:00
Merge pull request #8450 from jordan-woyak/mapping-button-fix
DolphinQt: Fix output mapping button spacebar activation and tooltip.
This commit is contained in:
commit
7c8a255ce1
@ -53,10 +53,17 @@ MappingButton::MappingButton(MappingWidget* parent, ControlReference* ref, bool
|
|||||||
|
|
||||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||||
|
|
||||||
setToolTip(
|
if (IsInput())
|
||||||
tr("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
|
{
|
||||||
|
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)
|
if (indicator)
|
||||||
connect(parent, &MappingWidget::Update, this, &MappingButton::UpdateIndicator);
|
connect(parent, &MappingWidget::Update, this, &MappingButton::UpdateIndicator);
|
||||||
@ -74,10 +81,13 @@ void MappingButton::AdvancedPressed()
|
|||||||
m_parent->SaveSettings();
|
m_parent->SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingButton::Detect()
|
void MappingButton::Clicked()
|
||||||
{
|
{
|
||||||
if (!m_reference->IsInput())
|
if (!m_reference->IsInput())
|
||||||
|
{
|
||||||
|
AdvancedPressed();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto default_device_qualifier = m_parent->GetController()->GetDefaultDevice();
|
const auto default_device_qualifier = m_parent->GetController()->GetDefaultDevice();
|
||||||
|
|
||||||
@ -141,12 +151,6 @@ void MappingButton::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
{
|
{
|
||||||
switch (event->button())
|
switch (event->button())
|
||||||
{
|
{
|
||||||
case Qt::MouseButton::LeftButton:
|
|
||||||
if (m_reference->IsInput())
|
|
||||||
QPushButton::mouseReleaseEvent(event);
|
|
||||||
else
|
|
||||||
AdvancedPressed();
|
|
||||||
return;
|
|
||||||
case Qt::MouseButton::MidButton:
|
case Qt::MouseButton::MidButton:
|
||||||
Clear();
|
Clear();
|
||||||
return;
|
return;
|
||||||
@ -154,6 +158,7 @@ void MappingButton::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
AdvancedPressed();
|
AdvancedPressed();
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
QPushButton::mouseReleaseEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ class MappingButton : public ElidedButton
|
|||||||
public:
|
public:
|
||||||
MappingButton(MappingWidget* widget, ControlReference* ref, bool indicator);
|
MappingButton(MappingWidget* widget, ControlReference* ref, bool indicator);
|
||||||
|
|
||||||
void Detect();
|
|
||||||
bool IsInput() const;
|
bool IsInput() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -27,6 +26,7 @@ private:
|
|||||||
void ConfigChanged();
|
void ConfigChanged();
|
||||||
void AdvancedPressed();
|
void AdvancedPressed();
|
||||||
|
|
||||||
|
void Clicked();
|
||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
|
|
||||||
MappingWidget* m_parent;
|
MappingWidget* m_parent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user