mainwindow: Allow CTRL + mouse wheel to zoom on previews
This commit is contained in:
rodzic
0c1b57d911
commit
fe610d3068
@ -75,6 +75,7 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath)
|
||||
ui->btnOpenFailed->setSizePolicy(policy);
|
||||
|
||||
ui->txtSearch->installEventFilter(this);
|
||||
ui->scrollArea->viewport()->installEventFilter(this);
|
||||
|
||||
this->ipcClientThread.start();
|
||||
}
|
||||
@ -494,6 +495,32 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(object == ui->scrollArea->viewport())
|
||||
{
|
||||
if(event->type() == QEvent::Wheel)
|
||||
{
|
||||
QWheelEvent *wheelEvent = static_cast<QWheelEvent *>(event);
|
||||
if(wheelEvent->modifiers() & Qt::ControlModifier)
|
||||
{
|
||||
if(wheelEvent->angleDelta().y() > 0)
|
||||
{
|
||||
if(ui->comboScale->currentIndex() < ui->comboScale->count() - 1)
|
||||
{
|
||||
ui->comboScale->setCurrentIndex(ui->comboScale->currentIndex() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(ui->comboScale->currentIndex() > 0)
|
||||
{
|
||||
ui->comboScale->setCurrentIndex(ui->comboScale->currentIndex() - 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return QMainWindow::eventFilter(object, event);
|
||||
}
|
||||
|
||||
|
Ładowanie…
Reference in New Issue
Block a user