summaryrefslogtreecommitdiffstats
path: root/tests/manual/qcursor/allcursors/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qcursor/allcursors/mainwindow.cpp')
-rw-r--r--tests/manual/qcursor/allcursors/mainwindow.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/manual/qcursor/allcursors/mainwindow.cpp b/tests/manual/qcursor/allcursors/mainwindow.cpp
new file mode 100644
index 0000000..0046ddb
--- /dev/null
+++ b/tests/manual/qcursor/allcursors/mainwindow.cpp
@@ -0,0 +1,43 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+#include <QTimer>
+#include <QBitmap>
+#include <QImage>
+#include <QPainter>
+#include <QKeyEvent>
+#include <QPoint>
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent), ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::keyPressEvent(QKeyEvent* event)
+{
+ QPoint off(0, 0);
+ switch (event->key()) {
+ case Qt::Key_Up:
+ off.setY(-4);
+ break;
+ case Qt::Key_Down:
+ off.setY(4);
+ break;
+ case Qt::Key_Left:
+ off.setX(-4);
+ break;
+ case Qt::Key_Right:
+ off.setX(4);
+ break;
+ default:
+ return QMainWindow::keyPressEvent(event);
+ }
+ off += QCursor::pos();
+ QCursor::setPos(off);
+}