diff options
author | Shane Kearns <shane.kearns@sosco.com> | 2009-09-15 14:12:08 +0200 |
---|---|---|
committer | Shane Kearns <shane.kearns@sosco.com> | 2009-09-15 16:05:53 +0200 |
commit | 56cec4cf9a8b04c979ced28cab89ce6232d4184a (patch) | |
tree | a9701f13161810d1e9bfbf7ef9cd8430a77580be /tests/manual/qcursor/allcursors | |
parent | f42f5c457b3368adb4c92e521dc56969f138bdd3 (diff) | |
download | qt4-tools-56cec4cf9a8b04c979ced28cab89ce6232d4184a.tar.gz |
QCursor support for Symbian OS
Reviewed-By: Jason Barron
Reviewed-By: Alessandro Portale
Summary:
QT_NO_CURSOR is now not defined for symbian builds
Existing QCursor APIs are all supported
New public API, QApplication::setNavigationMode, to allow the navigation
mode to be set. I.E. on an S60 3.2 phone, some applications will want a
virtual mouse cursor (web browser), while others are designed for keypad
navigation.
Symbian HAL is used for detecting input capabilities.
Fix DND, code cleanup & comment
QCursor visibility now uses a refcount, and is called from DND and the
setNavigationMode so they are both simpler and don't interfere with each
other.
QApplication::setNavigationMode
New public API for configuring cursor/keypad navi style.
This links in with ongoing work on the 4-way keypad navi branch, but
2-way and 4-way modes both act as 2-way mode until that is integrated
Some of the demos/examples have cursor switched on (those that were not
usable with keypad)
Virtual mouse support for non touch, non mouse phones (tested on N78)
add *.d and .metadata (carbide debug file / workspace dir) to .gitignore
System pointers are unavailable when using sprite workaround, so the
system cursor shapes are compiled into qtgui as resources.
MAC port does this also for shapes that aren't standard on the MAC.
Refactor Drag'n'Drop to use QCursor
Add test case to check all system cursor shapes
Simply a mainwindow containing a label widget for each cursor shape,
with the cursor property set appropriately
QCursor(QBitmap,QBitmap) supported
Fixed problem with the image & mask being inverted when using the
QCursor constructor that takes two mono bitmaps.
add .make.cache files to .gitignore
Correct implementation of QApplication::setOverrideCursor
QApplication::restoreOverrideCursor and QApplication::setOverrideCursor
are now working correctly on Symbian platform.
Performance will be slower compared with other platforms, because the
Symbian window server has a cursor associated with each native window.
Add test case for custom cursors
Create a pixmap cursor and associate it with a widget.
No changes to production code, since test passed 1st time ;)
Add manual test for QCursor
Make cursor independent of construction order
Updated to work around window server issue where contruction order
affects what cursor is displayed in child windows.
Also changed to effectiveWinId following review comments
Also fixed a problem which would make qcursor not link if configured
with QT_NO_CURSOR
Moved some multiply declared extern functions from cpp to _p.h files
Implemented Symbian versions of the cursor functions.
Merged in work I'd done based on tower.
Fill in bits of stub functions based on windows port
Removed QT_NO_CURSOR from list of config options forced on symbian
Recompiled configure.exe
Added stub functions for the missing functions in s60 port
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 0000000000..8e7da30752 --- /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 0000000000..9fb751037c --- /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 0000000000..0046ddbe23 --- /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 0000000000..e5c731c4e2 --- /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 0000000000..55ff78c605 --- /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> |