gui: handle ESC (to quit) and CTRL+L (focus on searchbar and select content)
This commit is contained in:
rodzic
563f518922
commit
bf6d817ace
@ -58,6 +58,27 @@ bool MainWindow::pdfTabActive()
|
|||||||
return ui->tabWidget->currentIndex() == 1;
|
return ui->tabWidget->currentIndex() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
bool quit =
|
||||||
|
((event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_Q) || event->key() == Qt::Key_Escape);
|
||||||
|
if(quit)
|
||||||
|
{
|
||||||
|
qApp->quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event->modifiers() & Qt::ControlModifier)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(event->key() == Qt::Key_L)
|
||||||
|
{
|
||||||
|
ui->txtSearch->setFocus();
|
||||||
|
ui->txtSearch->selectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QWidget::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::tabChanged()
|
void MainWindow::tabChanged()
|
||||||
{
|
{
|
||||||
if(pdfTabActive())
|
if(pdfTabActive())
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
|
#include <QKeyEvent>
|
||||||
#include "searchworker.h"
|
#include "searchworker.h"
|
||||||
#include "pdfworker.h"
|
#include "pdfworker.h"
|
||||||
namespace Ui
|
namespace Ui
|
||||||
@ -37,6 +37,7 @@ class MainWindow : public QMainWindow
|
|||||||
void connectSignals();
|
void connectSignals();
|
||||||
void makePdfPreview();
|
void makePdfPreview();
|
||||||
bool pdfTabActive();
|
bool pdfTabActive();
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
unsigned int processedPdfPreviews;
|
unsigned int processedPdfPreviews;
|
||||||
private slots:
|
private slots:
|
||||||
void lineEditReturnPressed();
|
void lineEditReturnPressed();
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboScale">
|
<widget class="QComboBox" name="comboScale">
|
||||||
<property name="currentText">
|
<property name="currentText">
|
||||||
<string>75%</string>
|
<string>25%</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -157,7 +157,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lblSearchResults">
|
<widget class="QLabel" name="lblSearchResults">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Ładowanie…
Reference in New Issue
Block a user