mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Qt: ignore double clicks unless they are left clicks
This commit is contained in:
parent
e56164f1e3
commit
fbebdc09b7
16 changed files with 152 additions and 11 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
constexpr auto qstr = QString::fromStdString;
|
constexpr auto qstr = QString::fromStdString;
|
||||||
|
|
||||||
|
@ -188,9 +189,12 @@ void breakpoint_list::HandleBreakpointRequest(u32 loc, bool only_add)
|
||||||
|
|
||||||
void breakpoint_list::OnBreakpointListDoubleClicked()
|
void breakpoint_list::OnBreakpointListDoubleClicked()
|
||||||
{
|
{
|
||||||
const u32 address = currentItem()->data(Qt::UserRole).value<u32>();
|
if (QListWidgetItem* item = currentItem())
|
||||||
|
{
|
||||||
|
const u32 address = item->data(Qt::UserRole).value<u32>();
|
||||||
Q_EMIT RequestShowAddress(address);
|
Q_EMIT RequestShowAddress(address);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void breakpoint_list::OnBreakpointListRightClicked(const QPoint &pos)
|
void breakpoint_list::OnBreakpointListRightClicked(const QPoint &pos)
|
||||||
{
|
{
|
||||||
|
@ -231,3 +235,18 @@ void breakpoint_list::OnBreakpointListDelete()
|
||||||
m_context_menu->close();
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -21,14 +21,20 @@ public:
|
||||||
|
|
||||||
QColor m_text_color_bp;
|
QColor m_text_color_bp;
|
||||||
QColor m_color_bp;
|
QColor m_color_bp;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false);
|
void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void HandleBreakpointRequest(u32 loc, bool add_only);
|
void HandleBreakpointRequest(u32 loc, bool add_only);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void OnBreakpointListDoubleClicked();
|
void OnBreakpointListDoubleClicked();
|
||||||
void OnBreakpointListRightClicked(const QPoint &pos);
|
void OnBreakpointListRightClicked(const QPoint &pos);
|
||||||
void OnBreakpointListDelete();
|
void OnBreakpointListDelete();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
breakpoint_handler* m_ppu_breakpoint_handler;
|
breakpoint_handler* m_ppu_breakpoint_handler;
|
||||||
QMenu* m_context_menu = nullptr;
|
QMenu* m_context_menu = nullptr;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Utilities/StrFmt.h"
|
#include "Utilities/StrFmt.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
constexpr auto qstr = QString::fromStdString;
|
constexpr auto qstr = QString::fromStdString;
|
||||||
|
|
||||||
|
@ -53,3 +54,18 @@ void call_stack_list::ShowItemAddress()
|
||||||
Q_EMIT RequestShowAddress(address);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -15,12 +15,17 @@ class call_stack_list : public QListWidget
|
||||||
public:
|
public:
|
||||||
explicit call_stack_list(QWidget* parent);
|
explicit call_stack_list(QWidget* parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false);
|
void RequestShowAddress(u32 addr, bool select_addr = true, bool force = false);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void HandleUpdate(const std::vector<std::pair<u32, u32>>& call_stack);
|
void HandleUpdate(const std::vector<std::pair<u32, u32>>& call_stack);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void ShowItemAddress();
|
void ShowItemAddress();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -242,3 +242,18 @@ void flow_widget::on_navigate(flow_navigation value)
|
||||||
|
|
||||||
m_selected_index = selected_index;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ private Q_SLOTS:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void select_item(flow_widget_item* item);
|
void select_item(flow_widget_item* item);
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int find_item(const flow_layout::position& pos);
|
int find_item(const flow_layout::position& pos);
|
||||||
|
|
|
@ -118,6 +118,21 @@ void game_list::mouseMoveEvent(QMouseEvent *event)
|
||||||
m_last_hover_item = new_item;
|
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)
|
void game_list::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
const auto modifiers = event->modifiers();
|
const auto modifiers = event->modifiers();
|
||||||
|
|
|
@ -43,6 +43,7 @@ protected:
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
void mouseMoveEvent(QMouseEvent* event) override;
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
void leaveEvent(QEvent* event) override;
|
void leaveEvent(QEvent* event) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
constexpr auto qstr = QString::fromStdString;
|
constexpr auto qstr = QString::fromStdString;
|
||||||
|
|
||||||
|
@ -229,3 +230,18 @@ void save_data_list_dialog::UpdateList()
|
||||||
|
|
||||||
resize(preferred_size.boundedTo(max_size));
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -25,9 +25,14 @@ public:
|
||||||
explicit save_data_list_dialog(const std::vector<SaveDataEntry>& entries, s32 focusedEntry, u32 op, vm::ptr<CellSaveDataListSet>, QWidget* parent = nullptr);
|
explicit save_data_list_dialog(const std::vector<SaveDataEntry>& entries, s32 focusedEntry, u32 op, vm::ptr<CellSaveDataListSet>, QWidget* parent = nullptr);
|
||||||
|
|
||||||
s32 GetSelection() const;
|
s32 GetSelection() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void OnEntryInfo();
|
void OnEntryInfo();
|
||||||
void OnSort(int logicalIndex);
|
void OnSort(int logicalIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateSelectionLabel();
|
void UpdateSelectionLabel();
|
||||||
void UpdateList();
|
void UpdateList();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <QRegularExpressionValidator>
|
#include <QRegularExpressionValidator>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
@ -496,3 +497,18 @@ bool user_manager_dialog::eventFilter(QObject *object, QEvent *event)
|
||||||
|
|
||||||
return QDialog::eventFilter(object, 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);
|
||||||
|
}
|
||||||
|
|
|
@ -15,16 +15,23 @@ class persistent_settings;
|
||||||
class user_manager_dialog : public QDialog
|
class user_manager_dialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit user_manager_dialog(std::shared_ptr<gui_settings> gui_settings, std::shared_ptr<persistent_settings> persistent_settings, QWidget* parent = nullptr);
|
explicit user_manager_dialog(std::shared_ptr<gui_settings> gui_settings, std::shared_ptr<persistent_settings> persistent_settings, QWidget* parent = nullptr);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void OnUserLoginSuccess();
|
void OnUserLoginSuccess();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void OnUserLogin();
|
void OnUserLogin();
|
||||||
void OnUserCreate();
|
void OnUserCreate();
|
||||||
void OnUserRemove();
|
void OnUserRemove();
|
||||||
void OnUserRename();
|
void OnUserRename();
|
||||||
void OnSort(int logicalIndex);
|
void OnSort(int logicalIndex);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void UpdateTable(bool mark_only = false);
|
void UpdateTable(bool mark_only = false);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
constexpr int max_usb_devices = 8;
|
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());
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,9 @@ public:
|
||||||
// Reset this tab without saving the settings yet
|
// Reset this tab without saving the settings yet
|
||||||
void reset() const;
|
void reset() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void show_usb_input_dialog(int index);
|
void show_usb_input_dialog(int index);
|
||||||
void show_context_menu(const QPoint& pos);
|
void show_context_menu(const QPoint& pos);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue