Don't switch pages when right-clicking on list

pull/216/head
PlutonicOverkill 8 years ago
parent 7281e8b888
commit 5ec97811d8

@ -2,6 +2,7 @@
#include <QMenu>
#include <QContextMenuEvent>
#include <QMouseEvent>
#include "../../model/prefs/state.hpp"
@ -21,6 +22,17 @@ void CSVPrefs::ContextMenuList::contextMenuEvent(QContextMenuEvent* e)
delete menu;
}
void CSVPrefs::ContextMenuList::mousePressEvent(QMouseEvent* e)
{
// enable all buttons except right click
// This means that when right-clicking to enable the
// context menu, the page doesn't switch at the same time.
if (!(e->buttons() & Qt::RightButton))
{
QListWidget::mousePressEvent(e);
}
}
void CSVPrefs::ContextMenuList::resetCategory()
{
CSMPrefs::State::get().resetCategory(currentItem()->text().toStdString());

@ -4,6 +4,7 @@
#include <QListWidget>
class QContextMenuEvent;
class QMouseEvent;
namespace CSVPrefs
{
@ -18,6 +19,8 @@ namespace CSVPrefs
protected:
void contextMenuEvent(QContextMenuEvent* e);
void mousePressEvent(QMouseEvent* e);
private slots:

Loading…
Cancel
Save