mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
Qt: ignore double clicks unless they are left clicks
This commit is contained in:
parent
e56164f1e3
commit
fbebdc09b7
@ -7,6 +7,7 @@
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
|
||||
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<u32>();
|
||||
Q_EMIT RequestShowAddress(address);
|
||||
if (QListWidgetItem* item = currentItem())
|
||||
{
|
||||
const u32 address = item->data(Qt::UserRole).value<u32>();
|
||||
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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "Utilities/StrFmt.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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<std::pair<u32, u32>>& call_stack);
|
||||
|
||||
private Q_SLOTS:
|
||||
void ShowItemAddress();
|
||||
|
||||
private:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<movie_item*>(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)
|
||||
{
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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:
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QHeaderView>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QMouseEvent>
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
s32 GetSelection() const;
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void OnEntryInfo();
|
||||
void OnSort(int logicalIndex);
|
||||
|
||||
private:
|
||||
void UpdateSelectionLabel();
|
||||
void UpdateList();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <QRegularExpressionValidator>
|
||||
#include <QInputDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QEvent>
|
||||
#include <QScreen>
|
||||
#include <QHeaderView>
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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> gui_settings, std::shared_ptr<persistent_settings> 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);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QHeaderView>
|
||||
#include <QScrollBar>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user