QTabletEvent manual test: add quit shortcut
Change-Id: I73012ec2d02856e5bbbc27d269f89b3918dd7c2d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
parent
68009a7d43
commit
35c8a21fe4
@ -33,7 +33,7 @@
|
|||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
|
|
||||||
TabletWidget::TabletWidget(bool mouseToo) : mMouseToo(mouseToo), mWheelEventCount(0)
|
TabletWidget::TabletWidget(bool mouseToo) : mMouseToo(mouseToo), mWheelEventCount(0), mQuitShortcut(QKeySequence::Quit, this)
|
||||||
{
|
{
|
||||||
QPalette newPalette = palette();
|
QPalette newPalette = palette();
|
||||||
newPalette.setColor(QPalette::Window, Qt::white);
|
newPalette.setColor(QPalette::Window, Qt::white);
|
||||||
@ -41,6 +41,7 @@ TabletWidget::TabletWidget(bool mouseToo) : mMouseToo(mouseToo), mWheelEventCoun
|
|||||||
setPalette(newPalette);
|
setPalette(newPalette);
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
resetAttributes();
|
resetAttributes();
|
||||||
|
connect(&mQuitShortcut, SIGNAL(activated()), qApp, SLOT(quit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabletWidget::eventFilter(QObject *, QEvent *ev)
|
bool TabletWidget::eventFilter(QObject *, QEvent *ev)
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTabletEvent>
|
#include <QTabletEvent>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
// a widget showing the information of the last tablet event
|
// a widget showing the information of the last tablet event
|
||||||
class TabletWidget : public QWidget
|
class TabletWidget : public QWidget
|
||||||
@ -64,6 +65,7 @@ private:
|
|||||||
bool mMouseToo;
|
bool mMouseToo;
|
||||||
ulong mTimestamp;
|
ulong mTimestamp;
|
||||||
int mWheelEventCount;
|
int mWheelEventCount;
|
||||||
|
QShortcut mQuitShortcut;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABLETWIDGET_H
|
#endif // TABLETWIDGET_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user