keyboard based picture dialog
This commit is contained in:
parent
e27fb3e480
commit
8734fd2e0c
3 changed files with 40 additions and 2 deletions
|
@ -34,8 +34,11 @@
|
|||
#include <QVariantMap>
|
||||
#include <QJsonArray>
|
||||
#include <QKeyEvent>
|
||||
#include <QMimeData>
|
||||
#include <QBuffer>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#include <QDrag>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
|
||||
|
@ -74,6 +77,7 @@ PictureDialog::~PictureDialog()
|
|||
|
||||
bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
bool returnValue = false;
|
||||
if (obj == this)
|
||||
{
|
||||
if (ev->type() == QEvent::KeyPress)
|
||||
|
@ -82,14 +86,33 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
|||
switch (keyEvent->key()){
|
||||
case Qt::Key_Left:
|
||||
emit previousPictureRequested();
|
||||
returnValue = true;
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
emit nextPictureRequested();
|
||||
returnValue = true;
|
||||
break;
|
||||
case Qt::Key_E: case Qt::Key_S: case Qt::Key_Save:
|
||||
ui->cmdExport->click();
|
||||
returnValue = true;
|
||||
break;
|
||||
case Qt::Key_C: case Qt::Key_Q: case Qt::Key_Exit:
|
||||
ui->cmdClose->click();
|
||||
returnValue = true;
|
||||
break;
|
||||
case Qt::Key_Enter: case Qt::Key_Return:
|
||||
on_labPicture_mouseDoubleClicked();
|
||||
returnValue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
void PictureDialog::mousePressEvent(QMouseEvent *ev)
|
||||
{
|
||||
ev->accept();
|
||||
}
|
||||
|
||||
void PictureDialog::dialogNextPictureRequested()
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "ProfileDatabase.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QDialog>
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Ui {
|
||||
|
@ -61,6 +63,7 @@ signals:
|
|||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void mousePressEvent(QMouseEvent *ev);
|
||||
|
||||
private:
|
||||
ProfileDatabase *profileDB;
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -119,22 +119,34 @@
|
|||
<layout class="QHBoxLayout" name="hlButtons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="cmdExport">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Export picture</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cmdClose">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue