diff options
Diffstat (limited to 'tests/manual/qcursor/allcursors')
-rw-r--r-- | tests/manual/qcursor/allcursors/allcursors.pro | 16 | ||||
-rw-r--r-- | tests/manual/qcursor/allcursors/main.cpp | 13 | ||||
-rw-r--r-- | tests/manual/qcursor/allcursors/mainwindow.cpp | 43 | ||||
-rw-r--r-- | tests/manual/qcursor/allcursors/mainwindow.h | 28 | ||||
-rw-r--r-- | tests/manual/qcursor/allcursors/mainwindow.ui | 210 |
5 files changed, 310 insertions, 0 deletions
diff --git a/tests/manual/qcursor/allcursors/allcursors.pro b/tests/manual/qcursor/allcursors/allcursors.pro new file mode 100644 index 0000000..8e7da30 --- /dev/null +++ b/tests/manual/qcursor/allcursors/allcursors.pro @@ -0,0 +1,16 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2009-08-05T17:13:23 +# +#------------------------------------------------- + +TARGET = tst_allcursors +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp + +HEADERS += mainwindow.h + +FORMS += mainwindow.ui diff --git a/tests/manual/qcursor/allcursors/main.cpp b/tests/manual/qcursor/allcursors/main.cpp new file mode 100644 index 0000000..9fb7510 --- /dev/null +++ b/tests/manual/qcursor/allcursors/main.cpp @@ -0,0 +1,13 @@ +#include <QtGui/QApplication> +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.showFullScreen(); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorForceVisible); +#endif + return a.exec(); +} 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); +} diff --git a/tests/manual/qcursor/allcursors/mainwindow.h b/tests/manual/qcursor/allcursors/mainwindow.h new file mode 100644 index 0000000..e5c731c --- /dev/null +++ b/tests/manual/qcursor/allcursors/mainwindow.h @@ -0,0 +1,28 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QtGui/QMainWindow> + +class QTimer; + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + void keyPressEvent(QKeyEvent* event); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/tests/manual/qcursor/allcursors/mainwindow.ui b/tests/manual/qcursor/allcursors/mainwindow.ui new file mode 100644 index 0000000..55ff78c --- /dev/null +++ b/tests/manual/qcursor/allcursors/mainwindow.ui @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>240</width> + <height>320</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Arrow</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_2"> + <property name="cursor"> + <cursorShape>UpArrowCursor</cursorShape> + </property> + <property name="text"> + <string>up arrow</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_3"> + <property name="cursor"> + <cursorShape>CrossCursor</cursorShape> + </property> + <property name="text"> + <string>cross</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="cursor"> + <cursorShape>WaitCursor</cursorShape> + </property> + <property name="text"> + <string>wait</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_5"> + <property name="cursor"> + <cursorShape>IBeamCursor</cursorShape> + </property> + <property name="text"> + <string>ibeam</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_6"> + <property name="cursor"> + <cursorShape>SizeVerCursor</cursorShape> + </property> + <property name="text"> + <string>sizever</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_7"> + <property name="cursor"> + <cursorShape>SizeHorCursor</cursorShape> + </property> + <property name="text"> + <string>sizehor</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_8"> + <property name="cursor"> + <cursorShape>SizeFDiagCursor</cursorShape> + </property> + <property name="text"> + <string>sizebdiag</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_9"> + <property name="cursor"> + <cursorShape>SizeBDiagCursor</cursorShape> + </property> + <property name="text"> + <string>sizefdiag</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_10"> + <property name="cursor"> + <cursorShape>SizeAllCursor</cursorShape> + </property> + <property name="text"> + <string>sizeall</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="label_11"> + <property name="cursor"> + <cursorShape>BlankCursor</cursorShape> + </property> + <property name="text"> + <string>blank</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="label_12"> + <property name="cursor"> + <cursorShape>SplitVCursor</cursorShape> + </property> + <property name="text"> + <string>splitv</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_13"> + <property name="cursor"> + <cursorShape>SplitHCursor</cursorShape> + </property> + <property name="text"> + <string>splith</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLabel" name="label_14"> + <property name="cursor"> + <cursorShape>PointingHandCursor</cursorShape> + </property> + <property name="text"> + <string>pointhand</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QLabel" name="label_15"> + <property name="cursor"> + <cursorShape>ForbiddenCursor</cursorShape> + </property> + <property name="text"> + <string>forbidden</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_16"> + <property name="cursor"> + <cursorShape>WhatsThisCursor</cursorShape> + </property> + <property name="text"> + <string>whatsthis</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="label_19"> + <property name="cursor"> + <cursorShape>BusyCursor</cursorShape> + </property> + <property name="text"> + <string>busy</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_17"> + <property name="cursor"> + <cursorShape>OpenHandCursor</cursorShape> + </property> + <property name="text"> + <string>openhand</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLabel" name="label_18"> + <property name="cursor"> + <cursorShape>ClosedHandCursor</cursorShape> + </property> + <property name="text"> + <string>closehand</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections/> +</ui> |