mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
Qt: Pass events to dialog when not remapping
This commit is contained in:
parent
36149fd986
commit
a42663b09b
1 changed files with 46 additions and 28 deletions
|
@ -708,19 +708,22 @@ void pad_settings_dialog::RepaintPreviewLabel(QLabel* l, int deadzone, int desir
|
||||||
|
|
||||||
void pad_settings_dialog::keyPressEvent(QKeyEvent *keyEvent)
|
void pad_settings_dialog::keyPressEvent(QKeyEvent *keyEvent)
|
||||||
{
|
{
|
||||||
if (m_handler->m_type != pad_handler::keyboard)
|
if (m_button_id == button_ids::id_pad_begin)
|
||||||
{
|
{
|
||||||
|
// We are not remapping a button, so pass the event to the base class.
|
||||||
|
QDialog::keyPressEvent(keyEvent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id == button_ids::id_pad_begin)
|
if (m_handler->m_type != pad_handler::keyboard)
|
||||||
{
|
{
|
||||||
|
// Do nothing, we don't want to interfere with the ongoing remapping.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
||||||
{
|
{
|
||||||
cfg_log.notice("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
cfg_log.error("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -733,19 +736,22 @@ void pad_settings_dialog::keyPressEvent(QKeyEvent *keyEvent)
|
||||||
|
|
||||||
void pad_settings_dialog::mouseReleaseEvent(QMouseEvent* event)
|
void pad_settings_dialog::mouseReleaseEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (m_handler->m_type != pad_handler::keyboard)
|
if (m_button_id == button_ids::id_pad_begin)
|
||||||
{
|
{
|
||||||
|
// We are not remapping a button, so pass the event to the base class.
|
||||||
|
QDialog::mouseReleaseEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id == button_ids::id_pad_begin)
|
if (m_handler->m_type != pad_handler::keyboard)
|
||||||
{
|
{
|
||||||
|
// Do nothing, we don't want to interfere with the ongoing remapping.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
||||||
{
|
{
|
||||||
cfg_log.notice("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
cfg_log.error("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -758,19 +764,22 @@ void pad_settings_dialog::mouseReleaseEvent(QMouseEvent* event)
|
||||||
|
|
||||||
void pad_settings_dialog::wheelEvent(QWheelEvent *event)
|
void pad_settings_dialog::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (m_handler->m_type != pad_handler::keyboard)
|
if (m_button_id == button_ids::id_pad_begin)
|
||||||
{
|
{
|
||||||
|
// We are not remapping a button, so pass the event to the base class.
|
||||||
|
QDialog::wheelEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id == button_ids::id_pad_begin)
|
if (m_handler->m_type != pad_handler::keyboard)
|
||||||
{
|
{
|
||||||
|
// Do nothing, we don't want to interfere with the ongoing remapping.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
||||||
{
|
{
|
||||||
cfg_log.notice("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
cfg_log.error("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,21 +822,24 @@ void pad_settings_dialog::wheelEvent(QWheelEvent *event)
|
||||||
ReactivateButtons();
|
ReactivateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pad_settings_dialog::mouseMoveEvent(QMouseEvent* /*event*/)
|
void pad_settings_dialog::mouseMoveEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (m_handler->m_type != pad_handler::keyboard)
|
if (m_button_id == button_ids::id_pad_begin)
|
||||||
{
|
{
|
||||||
|
// We are not remapping a button, so pass the event to the base class.
|
||||||
|
QDialog::mouseMoveEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id == button_ids::id_pad_begin)
|
if (m_handler->m_type != pad_handler::keyboard)
|
||||||
{
|
{
|
||||||
|
// Do nothing, we don't want to interfere with the ongoing remapping.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
if (m_button_id <= button_ids::id_pad_begin || m_button_id >= button_ids::id_pad_end)
|
||||||
{
|
{
|
||||||
cfg_log.notice("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
cfg_log.error("Pad Settings: Handler Type: %d, Unknown button ID: %d", static_cast<int>(m_handler->m_type), m_button_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -865,33 +877,39 @@ void pad_settings_dialog::mouseMoveEvent(QMouseEvent* /*event*/)
|
||||||
|
|
||||||
bool pad_settings_dialog::eventFilter(QObject* object, QEvent* event)
|
bool pad_settings_dialog::eventFilter(QObject* object, QEvent* event)
|
||||||
{
|
{
|
||||||
// Disabled buttons should not absorb mouseclicks
|
switch (event->type())
|
||||||
if (event->type() == QEvent::MouseButtonRelease)
|
|
||||||
{
|
{
|
||||||
|
case QEvent::MouseButtonRelease:
|
||||||
|
{
|
||||||
|
// Disabled buttons should not absorb mouseclicks
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (event->type() == QEvent::MouseMove)
|
case QEvent::MouseMove:
|
||||||
{
|
{
|
||||||
mouseMoveEvent(static_cast<QMouseEvent*>(event));
|
mouseMoveEvent(static_cast<QMouseEvent*>(event));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case QEvent::Enter:
|
||||||
if (event->type() == QEvent::Enter || event->type() == QEvent::Leave)
|
|
||||||
{
|
{
|
||||||
if (ui->l_description && m_descriptions.contains(object))
|
if (ui->l_description && m_descriptions.contains(object))
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::Enter)
|
// Check for visibility when entering a widget (needed in case of overlapping widgets in a QStackedWidget for example)
|
||||||
|
if (const auto widget = qobject_cast<QWidget*>(object); widget && widget->isVisible())
|
||||||
{
|
{
|
||||||
// Check for visibility when entering a widget (needed in case of overlapping widgets in a QStackedWidget for example)
|
ui->l_description->setText(m_descriptions[object]);
|
||||||
if (const auto widget = qobject_cast<QWidget*>(object); widget && widget->isVisible())
|
|
||||||
{
|
|
||||||
ui->l_description->setText(m_descriptions[object]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event->type() == QEvent::Leave)
|
|
||||||
{
|
|
||||||
ui->l_description->setText(m_description);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QEvent::Leave:
|
||||||
|
{
|
||||||
|
if (ui->l_description && m_descriptions.contains(object))
|
||||||
|
{
|
||||||
|
ui->l_description->setText(m_description);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(object, event);
|
return QDialog::eventFilter(object, event);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue