mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Detect back/forward mouse buttons to move back and forward through the browsing history
This commit is contained in:
parent
2b56945374
commit
0f9d782bb8
@ -139,6 +139,29 @@ void LibraryWindow::afterLaunchTasks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LibraryWindow::eventFilter(QObject *object, QEvent *event)
|
||||||
|
{
|
||||||
|
if (this->isActiveWindow()) {
|
||||||
|
if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
|
auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
|
|
||||||
|
if (mouseEvent->button() == Qt::ForwardButton) {
|
||||||
|
forwardAction->trigger();
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mouseEvent->button() == Qt::BackButton) {
|
||||||
|
backAction->trigger();
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QMainWindow::eventFilter(object, event);
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::createSettings()
|
void LibraryWindow::createSettings()
|
||||||
{
|
{
|
||||||
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
|
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
|
||||||
|
@ -434,6 +434,8 @@ public slots:
|
|||||||
|
|
||||||
void afterLaunchTasks();
|
void afterLaunchTasks();
|
||||||
|
|
||||||
|
bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @brief Exits search mode if it is active.
|
//! @brief Exits search mode if it is active.
|
||||||
//! @return true If the search mode was active when this function was called.
|
//! @return true If the search mode was active when this function was called.
|
||||||
|
@ -269,6 +269,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
app.installEventFilter(mw);
|
||||||
|
|
||||||
int ret = app.exec();
|
int ret = app.exec();
|
||||||
|
|
||||||
QLOG_INFO() << "YACReaderLibrary closed with exit code :" << ret;
|
QLOG_INFO() << "YACReaderLibrary closed with exit code :" << ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user