mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 10:58:51 +00:00
Add forward/back functionality to mouse buttons (#490)
* Add forward/back functionality to mouse buttons * Prevent other widgets from stealing mouseclicks for buttons 4 & 5
This commit is contained in:
parent
03b762a77a
commit
58226dda0e
@ -83,6 +83,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainWindow = new MainWindow();
|
mainWindow = new MainWindow();
|
||||||
|
installEventFilter(mainWindow);
|
||||||
|
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
if (analLevelSpecified) {
|
if (analLevelSpecified) {
|
||||||
|
@ -732,6 +732,33 @@ void MainWindow::projectSaved(const QString &name)
|
|||||||
addOutput(tr("Project saved: ") + name);
|
addOutput(tr("Project saved: ") + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
switch (event->button()) {
|
||||||
|
case Qt::BackButton:
|
||||||
|
Core()->seekPrev();
|
||||||
|
break;
|
||||||
|
case Qt::ForwardButton:
|
||||||
|
Core()->seekNext();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::eventFilter(QObject *, QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
|
if (mouseEvent->button() == Qt::ForwardButton || mouseEvent->button() == Qt::BackButton) {
|
||||||
|
mousePressEvent(mouseEvent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::addToDockWidgetList(QDockWidget *dockWidget)
|
void MainWindow::addToDockWidgetList(QDockWidget *dockWidget)
|
||||||
{
|
{
|
||||||
this->dockWidgets.push_back(dockWidget);
|
this->dockWidgets.push_back(dockWidget);
|
||||||
|
@ -154,6 +154,9 @@ private slots:
|
|||||||
|
|
||||||
void projectSaved(const QString &name);
|
void projectSaved(const QString &name);
|
||||||
|
|
||||||
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
bool eventFilter(QObject *object, QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CutterCore *core;
|
CutterCore *core;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user