diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-18 10:58:29 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-18 10:58:29 (GMT) |
commit | 7e8734879ea7619a632553b59b2a8bd491033cce (patch) | |
tree | 982f3a0ad66404afcffe0a06be31c1aa4caf3602 /examples/multitouch/dials | |
parent | 3b04dba36b31360d94583f382b9054bcdea0e2a7 (diff) | |
download | Qt-7e8734879ea7619a632553b59b2a8bd491033cce.zip Qt-7e8734879ea7619a632553b59b2a8bd491033cce.tar.gz Qt-7e8734879ea7619a632553b59b2a8bd491033cce.tar.bz2 |
update examples now that we get both touch and mouse events at the same time
added a new example to show how to enable touch for an existing widget (QDial in this case), and that
the mouse event emulation of QWidget does the Right Thing (tm)
Diffstat (limited to 'examples/multitouch/dials')
-rw-r--r-- | examples/multitouch/dials/dials.pro | 2 | ||||
-rw-r--r-- | examples/multitouch/dials/dials.ui | 77 | ||||
-rw-r--r-- | examples/multitouch/dials/main.cpp | 18 |
3 files changed, 97 insertions, 0 deletions
diff --git a/examples/multitouch/dials/dials.pro b/examples/multitouch/dials/dials.pro new file mode 100644 index 0000000..e592232 --- /dev/null +++ b/examples/multitouch/dials/dials.pro @@ -0,0 +1,2 @@ +SOURCES += main.cpp +FORMS += dials.ui diff --git a/examples/multitouch/dials/dials.ui b/examples/multitouch/dials/dials.ui new file mode 100644 index 0000000..8ca7ae9 --- /dev/null +++ b/examples/multitouch/dials/dials.ui @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Dials</class> + <widget class="QWidget" name="Dials"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QDial" name="dial_1"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDial" name="dial_2"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QDial" name="dial_3"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QDial" name="dial_4"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QDial" name="dial_5"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDial" name="dial_6"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QDial" name="dial_7"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QDial" name="dial_8"> + <property name="notchesVisible"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/multitouch/dials/main.cpp b/examples/multitouch/dials/main.cpp new file mode 100644 index 0000000..f4d3e83 --- /dev/null +++ b/examples/multitouch/dials/main.cpp @@ -0,0 +1,18 @@ +#include <QApplication> +#include <QWidget> +#include <QDial> + +#include "ui_dials.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QWidget window; + Ui::Dials dialsUi; + dialsUi.setupUi(&window); + QList<QAbstractSlider *> sliders = window.findChildren<QAbstractSlider *>(); + foreach (QAbstractSlider *slider, sliders) + slider->setAttribute(Qt::WA_AcceptTouchEvents); + window.showMaximized(); + return app.exec(); +} |