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 <QVariantMap>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QBuffer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QDrag>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
@ -74,6 +77,7 @@ PictureDialog::~PictureDialog()
|
||||||
|
|
||||||
bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
{
|
{
|
||||||
|
bool returnValue = false;
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
{
|
{
|
||||||
if (ev->type() == QEvent::KeyPress)
|
if (ev->type() == QEvent::KeyPress)
|
||||||
|
@ -82,14 +86,33 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
switch (keyEvent->key()){
|
switch (keyEvent->key()){
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
emit previousPictureRequested();
|
emit previousPictureRequested();
|
||||||
|
returnValue = true;
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Right:
|
case Qt::Key_Right:
|
||||||
emit nextPictureRequested();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PictureDialog::mousePressEvent(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::dialogNextPictureRequested()
|
void PictureDialog::dialogNextPictureRequested()
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
|
#include <QMouseEvent>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -61,6 +63,7 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProfileDatabase *profileDB;
|
ProfileDatabase *profileDB;
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::TextBrowserInteraction</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -119,22 +119,34 @@
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdExport">
|
<widget class="QPushButton" name="cmdExport">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::ClickFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Export picture</string>
|
<string>Export picture</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Export</string>
|
<string>&Export</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdClose">
|
<widget class="QPushButton" name="cmdClose">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::ClickFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Close</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in a new issue