diff --git a/rpcs3/rpcs3qt/breakpoint_list.cpp b/rpcs3/rpcs3qt/breakpoint_list.cpp index 18e2160704..7438028fa3 100644 --- a/rpcs3/rpcs3qt/breakpoint_list.cpp +++ b/rpcs3/rpcs3qt/breakpoint_list.cpp @@ -7,6 +7,7 @@ #include #include +#include constexpr auto qstr = QString::fromStdString; @@ -188,8 +189,11 @@ void breakpoint_list::HandleBreakpointRequest(u32 loc, bool only_add) void breakpoint_list::OnBreakpointListDoubleClicked() { - const u32 address = currentItem()->data(Qt::UserRole).value(); - Q_EMIT RequestShowAddress(address); + if (QListWidgetItem* item = currentItem()) + { + const u32 address = item->data(Qt::UserRole).value(); + Q_EMIT RequestShowAddress(address); + } } void breakpoint_list::OnBreakpointListRightClicked(const QPoint &pos) @@ -231,3 +235,18 @@ void breakpoint_list::OnBreakpointListDelete() m_context_menu->close(); } } + +void breakpoint_list::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QListWidget::mouseDoubleClickEvent(ev); +} diff --git a/rpcs3/rpcs3qt/breakpoint_list.h b/rpcs3/rpcs3qt/breakpoint_list.h index d498c332a1..5481e06efc 100644 --- a/rpcs3/rpcs3qt/breakpoint_list.h +++ b/rpcs3/rpcs3qt/breakpoint_list.h @@ -21,14 +21,20 @@ public: QColor m_text_color_bp; QColor m_color_bp; + +protected: + void mouseDoubleClickEvent(QMouseEvent* ev) override; + Q_SIGNALS: void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false); public Q_SLOTS: void HandleBreakpointRequest(u32 loc, bool add_only); + private Q_SLOTS: void OnBreakpointListDoubleClicked(); void OnBreakpointListRightClicked(const QPoint &pos); void OnBreakpointListDelete(); + private: breakpoint_handler* m_ppu_breakpoint_handler; QMenu* m_context_menu = nullptr; diff --git a/rpcs3/rpcs3qt/call_stack_list.cpp b/rpcs3/rpcs3qt/call_stack_list.cpp index b0626402a6..47d32a8cb9 100644 --- a/rpcs3/rpcs3qt/call_stack_list.cpp +++ b/rpcs3/rpcs3qt/call_stack_list.cpp @@ -3,6 +3,7 @@ #include "Utilities/StrFmt.h" #include +#include constexpr auto qstr = QString::fromStdString; @@ -53,3 +54,18 @@ void call_stack_list::ShowItemAddress() Q_EMIT RequestShowAddress(address); } } + +void call_stack_list::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QListWidget::mouseDoubleClickEvent(ev); +} diff --git a/rpcs3/rpcs3qt/call_stack_list.h b/rpcs3/rpcs3qt/call_stack_list.h index 1e04b28302..48a71dbbbb 100644 --- a/rpcs3/rpcs3qt/call_stack_list.h +++ b/rpcs3/rpcs3qt/call_stack_list.h @@ -15,12 +15,17 @@ class call_stack_list : public QListWidget public: explicit call_stack_list(QWidget* parent); +protected: + void mouseDoubleClickEvent(QMouseEvent* ev) override; + Q_SIGNALS: void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false); public Q_SLOTS: void HandleUpdate(const std::vector>& call_stack); + private Q_SLOTS: void ShowItemAddress(); + private: void keyPressEvent(QKeyEvent* event) override; }; diff --git a/rpcs3/rpcs3qt/flow_widget.cpp b/rpcs3/rpcs3qt/flow_widget.cpp index 10670f5f8f..74e716ed40 100644 --- a/rpcs3/rpcs3qt/flow_widget.cpp +++ b/rpcs3/rpcs3qt/flow_widget.cpp @@ -242,3 +242,18 @@ void flow_widget::on_navigate(flow_navigation value) m_selected_index = selected_index; } + +void flow_widget::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QWidget::mouseDoubleClickEvent(ev); +} diff --git a/rpcs3/rpcs3qt/flow_widget.h b/rpcs3/rpcs3qt/flow_widget.h index a0166b4dbb..cd9ab5b95b 100644 --- a/rpcs3/rpcs3qt/flow_widget.h +++ b/rpcs3/rpcs3qt/flow_widget.h @@ -33,6 +33,7 @@ private Q_SLOTS: protected: void select_item(flow_widget_item* item); + void mouseDoubleClickEvent(QMouseEvent* event) override; private: int find_item(const flow_layout::position& pos); diff --git a/rpcs3/rpcs3qt/game_list.cpp b/rpcs3/rpcs3qt/game_list.cpp index 1296d976b3..c60dd712a8 100644 --- a/rpcs3/rpcs3qt/game_list.cpp +++ b/rpcs3/rpcs3qt/game_list.cpp @@ -89,7 +89,7 @@ void game_list::fix_narrow_columns() } } -void game_list::mousePressEvent(QMouseEvent *event) +void game_list::mousePressEvent(QMouseEvent* event) { if (QTableWidgetItem* item = itemAt(event->pos()); !item || !item->data(Qt::UserRole).isValid()) { @@ -99,7 +99,7 @@ void game_list::mousePressEvent(QMouseEvent *event) QTableWidget::mousePressEvent(event); } -void game_list::mouseMoveEvent(QMouseEvent *event) +void game_list::mouseMoveEvent(QMouseEvent* event) { movie_item* new_item = static_cast(itemAt(event->pos())); @@ -118,6 +118,21 @@ void game_list::mouseMoveEvent(QMouseEvent *event) m_last_hover_item = new_item; } +void game_list::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QTableWidget::mouseDoubleClickEvent(ev); +} + void game_list::keyPressEvent(QKeyEvent* event) { const auto modifiers = event->modifiers(); @@ -131,7 +146,7 @@ void game_list::keyPressEvent(QKeyEvent* event) QTableWidget::keyPressEvent(event); } -void game_list::leaveEvent(QEvent */*event*/) +void game_list::leaveEvent(QEvent* /*event*/) { if (m_last_hover_item) { diff --git a/rpcs3/rpcs3qt/game_list.h b/rpcs3/rpcs3qt/game_list.h index 596054962f..93652b99a7 100644 --- a/rpcs3/rpcs3qt/game_list.h +++ b/rpcs3/rpcs3qt/game_list.h @@ -41,8 +41,9 @@ Q_SIGNALS: protected: movie_item* m_last_hover_item = nullptr; - void mousePressEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; - void keyPressEvent(QKeyEvent *event) override; - void leaveEvent(QEvent *event) override; + void mousePressEvent(QMouseEvent* event) override; + void mouseMoveEvent(QMouseEvent* event) override; + void mouseDoubleClickEvent(QMouseEvent* event) override; + void keyPressEvent(QKeyEvent* event) override; + void leaveEvent(QEvent* event) override; }; diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index aaa5c5e174..333671ed55 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -856,7 +856,7 @@ void game_list_frame::SaveSettings() m_gui_settings->SetValue(gui::gl_state, m_game_list->horizontalHeader()->saveState(), true); } -void game_list_frame::doubleClickedSlot(QTableWidgetItem *item) +void game_list_frame::doubleClickedSlot(QTableWidgetItem* item) { if (!item) { diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 34f2ca9a4a..b59dc1645e 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -84,7 +84,7 @@ private Q_SLOTS: void OnCompatFinished(); void OnColClicked(int col); void ShowContextMenu(const QPoint &pos); - void doubleClickedSlot(QTableWidgetItem *item); + void doubleClickedSlot(QTableWidgetItem* item); void doubleClickedSlot(const game_info& game); void ItemSelectionChangedSlot(); Q_SIGNALS: diff --git a/rpcs3/rpcs3qt/save_data_list_dialog.cpp b/rpcs3/rpcs3qt/save_data_list_dialog.cpp index ca271b294f..6275161892 100644 --- a/rpcs3/rpcs3qt/save_data_list_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_list_dialog.cpp @@ -8,6 +8,7 @@ #include #include #include +#include constexpr auto qstr = QString::fromStdString; @@ -229,3 +230,18 @@ void save_data_list_dialog::UpdateList() resize(preferred_size.boundedTo(max_size)); } + +void save_data_list_dialog::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QDialog::mouseDoubleClickEvent(ev); +} diff --git a/rpcs3/rpcs3qt/save_data_list_dialog.h b/rpcs3/rpcs3qt/save_data_list_dialog.h index a7d66a794e..334b45ca4b 100644 --- a/rpcs3/rpcs3qt/save_data_list_dialog.h +++ b/rpcs3/rpcs3qt/save_data_list_dialog.h @@ -25,9 +25,14 @@ public: explicit save_data_list_dialog(const std::vector& entries, s32 focusedEntry, u32 op, vm::ptr, QWidget* parent = nullptr); s32 GetSelection() const; + +protected: + void mouseDoubleClickEvent(QMouseEvent* ev) override; + private Q_SLOTS: void OnEntryInfo(); void OnSort(int logicalIndex); + private: void UpdateSelectionLabel(); void UpdateList(); diff --git a/rpcs3/rpcs3qt/user_manager_dialog.cpp b/rpcs3/rpcs3qt/user_manager_dialog.cpp index 8314e6182c..24336bd089 100644 --- a/rpcs3/rpcs3qt/user_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/user_manager_dialog.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -496,3 +497,18 @@ bool user_manager_dialog::eventFilter(QObject *object, QEvent *event) return QDialog::eventFilter(object, event); } + +void user_manager_dialog::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QDialog::mouseDoubleClickEvent(ev); +} diff --git a/rpcs3/rpcs3qt/user_manager_dialog.h b/rpcs3/rpcs3qt/user_manager_dialog.h index 93fbc3245c..75d0ba23e1 100644 --- a/rpcs3/rpcs3qt/user_manager_dialog.h +++ b/rpcs3/rpcs3qt/user_manager_dialog.h @@ -15,16 +15,23 @@ class persistent_settings; class user_manager_dialog : public QDialog { Q_OBJECT + public: explicit user_manager_dialog(std::shared_ptr gui_settings, std::shared_ptr persistent_settings, QWidget* parent = nullptr); + Q_SIGNALS: void OnUserLoginSuccess(); + private Q_SLOTS: void OnUserLogin(); void OnUserCreate(); void OnUserRemove(); void OnUserRename(); void OnSort(int logicalIndex); + +protected: + void mouseDoubleClickEvent(QMouseEvent* ev) override; + private: void Init(); void UpdateTable(bool mark_only = false); diff --git a/rpcs3/rpcs3qt/vfs_dialog_usb_tab.cpp b/rpcs3/rpcs3qt/vfs_dialog_usb_tab.cpp index c9befc9cba..93fadf8ece 100644 --- a/rpcs3/rpcs3qt/vfs_dialog_usb_tab.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog_usb_tab.cpp @@ -7,6 +7,7 @@ #include #include #include +#include constexpr int max_usb_devices = 8; @@ -165,3 +166,18 @@ void vfs_dialog_usb_tab::double_clicked_slot(QTableWidgetItem* item) show_usb_input_dialog(item->row()); } + +void vfs_dialog_usb_tab::mouseDoubleClickEvent(QMouseEvent* ev) +{ + if (!ev) return; + + // Qt's itemDoubleClicked signal doesn't distinguish between mouse buttons and there is no simple way to get the pressed button. + // So we have to ignore this event when another button is pressed. + if (ev->button() != Qt::LeftButton) + { + ev->ignore(); + return; + } + + QWidget::mouseDoubleClickEvent(ev); +} diff --git a/rpcs3/rpcs3qt/vfs_dialog_usb_tab.h b/rpcs3/rpcs3qt/vfs_dialog_usb_tab.h index a07ac040f8..65cea0a2c3 100644 --- a/rpcs3/rpcs3qt/vfs_dialog_usb_tab.h +++ b/rpcs3/rpcs3qt/vfs_dialog_usb_tab.h @@ -26,6 +26,9 @@ public: // Reset this tab without saving the settings yet void reset() const; +protected: + void mouseDoubleClickEvent(QMouseEvent* ev) override; + private: void show_usb_input_dialog(int index); void show_context_menu(const QPoint& pos);