diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-23 15:54:17 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-23 15:54:17 (GMT) |
commit | 66ed5fc90fe44554e852a6f8dca4548154da781c (patch) | |
tree | ff2fe1a15f8a39a9a05924592b95d7e2a6b71584 | |
parent | 704261859297dae22f90be32ed0e4b675fd02ed3 (diff) | |
download | Qt-66ed5fc90fe44554e852a6f8dca4548154da781c.zip Qt-66ed5fc90fe44554e852a6f8dca4548154da781c.tar.gz Qt-66ed5fc90fe44554e852a6f8dca4548154da781c.tar.bz2 |
update test to test basic event handling and touch begin propagation
-rw-r--r-- | tests/manual/qtouchevent/form.ui | 572 | ||||
-rw-r--r-- | tests/manual/qtouchevent/main.cpp | 152 | ||||
-rw-r--r-- | tests/manual/qtouchevent/touchwidget.cpp | 7 |
3 files changed, 460 insertions, 271 deletions
diff --git a/tests/manual/qtouchevent/form.ui b/tests/manual/qtouchevent/form.ui index 00e15ae..6cf4cba 100644 --- a/tests/manual/qtouchevent/form.ui +++ b/tests/manual/qtouchevent/form.ui @@ -6,16 +6,16 @@ <rect> <x>0</x> <y>0</y> - <width>791</width> - <height>499</height> + <width>770</width> + <height>424</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="TouchWidget" name="greenWidget" native="true"> + <item row="2" column="1"> + <widget class="TouchWidget" name="redWidget" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <horstretch>0</horstretch> @@ -37,8 +37,8 @@ <colorrole role="Button"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -46,8 +46,8 @@ <colorrole role="Light"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>255</green> + <red>255</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -55,8 +55,8 @@ <colorrole role="Midlight"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>212</green> + <red>212</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -64,8 +64,8 @@ <colorrole role="Dark"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>85</green> + <red>85</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -73,8 +73,8 @@ <colorrole role="Mid"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>113</green> + <red>113</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -118,8 +118,8 @@ <colorrole role="Window"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -136,8 +136,8 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>127</red> - <green>212</green> + <red>212</red> + <green>127</green> <blue>127</blue> </color> </brush> @@ -174,8 +174,8 @@ <colorrole role="Button"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -183,8 +183,8 @@ <colorrole role="Light"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>255</green> + <red>255</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -192,8 +192,8 @@ <colorrole role="Midlight"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>212</green> + <red>212</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -201,8 +201,8 @@ <colorrole role="Dark"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>85</green> + <red>85</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -210,8 +210,8 @@ <colorrole role="Mid"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>113</green> + <red>113</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -255,8 +255,8 @@ <colorrole role="Window"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -273,8 +273,8 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>127</red> - <green>212</green> + <red>212</red> + <green>127</green> <blue>127</blue> </color> </brush> @@ -302,8 +302,8 @@ <colorrole role="WindowText"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>85</green> + <red>85</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -311,8 +311,8 @@ <colorrole role="Button"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -320,8 +320,8 @@ <colorrole role="Light"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>255</green> + <red>255</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -329,8 +329,8 @@ <colorrole role="Midlight"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>212</green> + <red>212</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -338,8 +338,8 @@ <colorrole role="Dark"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>85</green> + <red>85</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -347,8 +347,8 @@ <colorrole role="Mid"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>113</green> + <red>113</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -356,8 +356,8 @@ <colorrole role="Text"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>85</green> + <red>85</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -374,8 +374,8 @@ <colorrole role="ButtonText"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>85</green> + <red>85</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -383,8 +383,8 @@ <colorrole role="Base"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -392,8 +392,8 @@ <colorrole role="Window"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -410,8 +410,8 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>0</red> - <green>170</green> + <red>170</red> + <green>0</green> <blue>0</blue> </color> </brush> @@ -440,35 +440,41 @@ <property name="autoFillBackground"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="1"> - <spacer name="verticalSpacer"> + <spacer name="verticalSpacer_4"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>20</width> - <height>290</height> + <width>0</width> + <height>0</height> </size> </property> </spacer> </item> <item row="1" column="0"> - <spacer name="horizontalSpacer_3"> + <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>84</width> - <height>20</height> + <width>0</width> + <height>0</height> </size> </property> </spacer> </item> <item row="1" column="1"> - <widget class="TouchWidget" name="blueWidget" native="true"> + <widget class="TouchWidget" name="greyWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="minimumSize"> <size> <width>180</width> @@ -481,9 +487,9 @@ <colorrole role="WindowText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> @@ -492,7 +498,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -501,7 +507,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>255</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -510,7 +516,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>212</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -519,7 +525,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>85</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -528,16 +534,16 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>113</blue> + <blue>0</blue> </color> </brush> </colorrole> <colorrole role="Text"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> @@ -553,18 +559,18 @@ <colorrole role="ButtonText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> <colorrole role="Base"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -573,7 +579,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -589,9 +595,9 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>127</red> - <green>127</green> - <blue>212</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -618,9 +624,9 @@ <colorrole role="WindowText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> @@ -629,7 +635,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -638,7 +644,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>255</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -647,7 +653,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>212</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -656,7 +662,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>85</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -665,16 +671,16 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>113</blue> + <blue>0</blue> </color> </brush> </colorrole> <colorrole role="Text"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> @@ -690,18 +696,18 @@ <colorrole role="ButtonText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> <colorrole role="Base"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -710,7 +716,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -726,9 +732,9 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>127</red> - <green>127</green> - <blue>212</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -757,7 +763,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>85</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -766,7 +772,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -775,7 +781,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>255</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -784,7 +790,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>212</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -793,7 +799,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>85</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -802,7 +808,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>113</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -811,7 +817,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>85</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -829,7 +835,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>85</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -838,7 +844,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -847,7 +853,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -865,7 +871,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>170</blue> + <blue>0</blue> </color> </brush> </colorrole> @@ -896,14 +902,27 @@ </widget> </item> <item row="1" column="2"> - <spacer name="horizontalSpacer_2"> + <spacer name="horizontalSpacer_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>84</width> - <height>20</height> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> </size> </property> </spacer> @@ -911,8 +930,34 @@ </layout> </widget> </item> - <item row="0" column="1"> - <widget class="TouchWidget" name="redWidget" native="true"> + <item row="0" column="0"> + <widget class="QLabel" name="testNameLabel"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Test Name</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="testDescriptionLabel"> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="text"> + <string>Test description</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="TouchWidget" name="greenWidget" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <horstretch>0</horstretch> @@ -934,8 +979,8 @@ <colorrole role="Button"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -943,8 +988,8 @@ <colorrole role="Light"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>255</red> - <green>0</green> + <red>0</red> + <green>255</green> <blue>0</blue> </color> </brush> @@ -952,8 +997,8 @@ <colorrole role="Midlight"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>212</red> - <green>0</green> + <red>0</red> + <green>212</green> <blue>0</blue> </color> </brush> @@ -961,8 +1006,8 @@ <colorrole role="Dark"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>85</red> - <green>0</green> + <red>0</red> + <green>85</green> <blue>0</blue> </color> </brush> @@ -970,8 +1015,8 @@ <colorrole role="Mid"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>113</red> - <green>0</green> + <red>0</red> + <green>113</green> <blue>0</blue> </color> </brush> @@ -1015,8 +1060,8 @@ <colorrole role="Window"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1033,8 +1078,8 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>212</red> - <green>127</green> + <red>127</red> + <green>212</green> <blue>127</blue> </color> </brush> @@ -1071,8 +1116,8 @@ <colorrole role="Button"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1080,8 +1125,8 @@ <colorrole role="Light"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>255</red> - <green>0</green> + <red>0</red> + <green>255</green> <blue>0</blue> </color> </brush> @@ -1089,8 +1134,8 @@ <colorrole role="Midlight"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>212</red> - <green>0</green> + <red>0</red> + <green>212</green> <blue>0</blue> </color> </brush> @@ -1098,8 +1143,8 @@ <colorrole role="Dark"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>85</red> - <green>0</green> + <red>0</red> + <green>85</green> <blue>0</blue> </color> </brush> @@ -1107,8 +1152,8 @@ <colorrole role="Mid"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>113</red> - <green>0</green> + <red>0</red> + <green>113</green> <blue>0</blue> </color> </brush> @@ -1152,8 +1197,8 @@ <colorrole role="Window"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1170,8 +1215,8 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>212</red> - <green>127</green> + <red>127</red> + <green>212</green> <blue>127</blue> </color> </brush> @@ -1199,8 +1244,8 @@ <colorrole role="WindowText"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>85</red> - <green>0</green> + <red>0</red> + <green>85</green> <blue>0</blue> </color> </brush> @@ -1208,8 +1253,8 @@ <colorrole role="Button"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1217,8 +1262,8 @@ <colorrole role="Light"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>255</red> - <green>0</green> + <red>0</red> + <green>255</green> <blue>0</blue> </color> </brush> @@ -1226,8 +1271,8 @@ <colorrole role="Midlight"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>212</red> - <green>0</green> + <red>0</red> + <green>212</green> <blue>0</blue> </color> </brush> @@ -1235,8 +1280,8 @@ <colorrole role="Dark"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>85</red> - <green>0</green> + <red>0</red> + <green>85</green> <blue>0</blue> </color> </brush> @@ -1244,8 +1289,8 @@ <colorrole role="Mid"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>113</red> - <green>0</green> + <red>0</red> + <green>113</green> <blue>0</blue> </color> </brush> @@ -1253,8 +1298,8 @@ <colorrole role="Text"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>85</red> - <green>0</green> + <red>0</red> + <green>85</green> <blue>0</blue> </color> </brush> @@ -1271,8 +1316,8 @@ <colorrole role="ButtonText"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>85</red> - <green>0</green> + <red>0</red> + <green>85</green> <blue>0</blue> </color> </brush> @@ -1280,8 +1325,8 @@ <colorrole role="Base"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1289,8 +1334,8 @@ <colorrole role="Window"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1307,8 +1352,8 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="63"> - <red>170</red> - <green>0</green> + <red>0</red> + <green>170</green> <blue>0</blue> </color> </brush> @@ -1337,35 +1382,28 @@ <property name="autoFillBackground"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="1"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>290</height> - </size> - </property> - </spacer> - </item> + <layout class="QGridLayout" name="gridLayout_3"> <item row="1" column="0"> - <spacer name="horizontalSpacer"> + <spacer name="horizontalSpacer_3"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>84</width> - <height>20</height> + <width>0</width> + <height>0</height> </size> </property> </spacer> </item> <item row="1" column="1"> - <widget class="TouchWidget" name="greyWidget" native="true"> + <widget class="TouchWidget" name="blueWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="minimumSize"> <size> <width>180</width> @@ -1378,9 +1416,9 @@ <colorrole role="WindowText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -1389,7 +1427,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1398,7 +1436,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>255</blue> </color> </brush> </colorrole> @@ -1407,7 +1445,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>212</blue> </color> </brush> </colorrole> @@ -1416,7 +1454,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>85</blue> </color> </brush> </colorrole> @@ -1425,16 +1463,16 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>113</blue> </color> </brush> </colorrole> <colorrole role="Text"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -1450,18 +1488,18 @@ <colorrole role="ButtonText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> <colorrole role="Base"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> @@ -1470,7 +1508,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1486,9 +1524,9 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>127</red> + <green>127</green> + <blue>212</blue> </color> </brush> </colorrole> @@ -1515,9 +1553,9 @@ <colorrole role="WindowText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -1526,7 +1564,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1535,7 +1573,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>255</blue> </color> </brush> </colorrole> @@ -1544,7 +1582,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>212</blue> </color> </brush> </colorrole> @@ -1553,7 +1591,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>85</blue> </color> </brush> </colorrole> @@ -1562,16 +1600,16 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>113</blue> </color> </brush> </colorrole> <colorrole role="Text"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> @@ -1587,18 +1625,18 @@ <colorrole role="ButtonText"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> + <red>0</red> + <green>0</green> + <blue>0</blue> </color> </brush> </colorrole> <colorrole role="Base"> <brush brushstyle="SolidPattern"> <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>255</red> + <green>255</green> + <blue>255</blue> </color> </brush> </colorrole> @@ -1607,7 +1645,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1623,9 +1661,9 @@ <colorrole role="AlternateBase"> <brush brushstyle="SolidPattern"> <color alpha="159"> - <red>0</red> - <green>0</green> - <blue>0</blue> + <red>127</red> + <green>127</green> + <blue>212</blue> </color> </brush> </colorrole> @@ -1654,7 +1692,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>85</blue> </color> </brush> </colorrole> @@ -1663,7 +1701,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1672,7 +1710,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>255</blue> </color> </brush> </colorrole> @@ -1681,7 +1719,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>212</blue> </color> </brush> </colorrole> @@ -1690,7 +1728,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>85</blue> </color> </brush> </colorrole> @@ -1699,7 +1737,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>113</blue> </color> </brush> </colorrole> @@ -1708,7 +1746,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>85</blue> </color> </brush> </colorrole> @@ -1726,7 +1764,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>85</blue> </color> </brush> </colorrole> @@ -1735,7 +1773,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1744,7 +1782,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1762,7 +1800,7 @@ <color alpha="63"> <red>0</red> <green>0</green> - <blue>0</blue> + <blue>170</blue> </color> </brush> </colorrole> @@ -1793,14 +1831,40 @@ </widget> </item> <item row="1" column="2"> - <spacer name="horizontalSpacer_4"> + <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>83</width> - <height>20</height> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> </size> </property> </spacer> @@ -1808,26 +1872,6 @@ </layout> </widget> </item> - <item row="1" column="0" colspan="2"> - <widget class="QLabel" name="testNameLabel"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Test Name</string> - </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QLabel" name="testDescriptionLabel"> - <property name="text"> - <string>Test description</string> - </property> - </widget> - </item> </layout> </widget> <customwidgets> diff --git a/tests/manual/qtouchevent/main.cpp b/tests/manual/qtouchevent/main.cpp index 2aab4ca..7ed9b15 100644 --- a/tests/manual/qtouchevent/main.cpp +++ b/tests/manual/qtouchevent/main.cpp @@ -12,8 +12,15 @@ public: MultitouchTestWidget(QWidget *parent = 0) : QWidget(parent) { + setAttribute(Qt::WA_QuitOnClose, false);\ setupUi(this); } + + void closeEvent(QCloseEvent *event) + { + event->accept(); + QTimer::singleShot(1000, qApp, SLOT(quit())); + } }; class tst_ManualMultitouch : public QObject @@ -25,7 +32,8 @@ public: ~tst_ManualMultitouch(); private slots: - void touchBeginPropagation(); + void basicEventHandling(); + void touchEventPropagation(); }; tst_ManualMultitouch::tst_ManualMultitouch() @@ -34,11 +42,99 @@ tst_ManualMultitouch::tst_ManualMultitouch() tst_ManualMultitouch::~tst_ManualMultitouch() { } -void tst_ManualMultitouch::touchBeginPropagation() +void tst_ManualMultitouch::basicEventHandling() +{ + // first, make sure that we get mouse events when not enabling touch events + MultitouchTestWidget testWidget; + testWidget.testNameLabel->setText("Basic QTouchEvent handling test"); + testWidget.testDescriptionLabel->setText("Touch, hold, and release your finger on the green widget."); + testWidget.redWidget->hide(); + testWidget.blueWidget->hide(); + testWidget.greenWidget->closeWindowOnMouseRelease = true; + testWidget.showMaximized(); + + (void) qApp->exec(); + QVERIFY(!testWidget.greenWidget->seenTouchBegin); + QVERIFY(!testWidget.greenWidget->seenTouchUpdate); + QVERIFY(!testWidget.greenWidget->seenTouchEnd); + QVERIFY(testWidget.greenWidget->seenMousePress); + // QVERIFY(testWidget.greenWidget->seenMouseMove); + QVERIFY(testWidget.greenWidget->seenMouseRelease); + + // now enable touch and make sure we get the touch events + testWidget.greenWidget->reset(); + testWidget.greenWidget->setAttribute(Qt::WA_AcceptTouchEvents); + testWidget.greenWidget->acceptTouchBegin = true; + testWidget.greenWidget->acceptTouchUpdate = true; + testWidget.greenWidget->acceptTouchEnd = true; + testWidget.greenWidget->closeWindowOnTouchEnd = true; + testWidget.showMaximized(); + + (void) qApp->exec(); + QVERIFY(testWidget.greenWidget->seenTouchBegin + && testWidget.greenWidget->seenTouchUpdate + && testWidget.greenWidget->seenTouchEnd); + QVERIFY(!testWidget.greenWidget->seenMousePress + && !testWidget.greenWidget->seenMouseMove + && !testWidget.greenWidget->seenMouseRelease); + + // again, ignoring the TouchEnd + testWidget.greenWidget->reset(); + testWidget.greenWidget->acceptTouchBegin = true; + testWidget.greenWidget->acceptTouchUpdate = true; + // testWidget.greenWidget->acceptTouchEnd = true; + testWidget.greenWidget->closeWindowOnTouchEnd = true; + testWidget.showMaximized(); + + (void) qApp->exec(); + QVERIFY(testWidget.greenWidget->seenTouchBegin); + QVERIFY(testWidget.greenWidget->seenTouchUpdate); + QVERIFY(testWidget.greenWidget->seenTouchEnd); + QVERIFY(!testWidget.greenWidget->seenMousePress); + QVERIFY(!testWidget.greenWidget->seenMouseMove); + QVERIFY(!testWidget.greenWidget->seenMouseRelease); + + // again, ignoring TouchUpdates + testWidget.greenWidget->reset(); + testWidget.greenWidget->acceptTouchBegin = true; + // testWidget.greenWidget->acceptTouchUpdate = true; + testWidget.greenWidget->acceptTouchEnd = true; + testWidget.greenWidget->closeWindowOnTouchEnd = true; + testWidget.showMaximized(); + + (void) qApp->exec(); + QVERIFY(testWidget.greenWidget->seenTouchBegin); + QVERIFY(testWidget.greenWidget->seenTouchUpdate); + QVERIFY(testWidget.greenWidget->seenTouchEnd); + QVERIFY(!testWidget.greenWidget->seenMousePress); + QVERIFY(!testWidget.greenWidget->seenMouseMove); + QVERIFY(!testWidget.greenWidget->seenMouseRelease); + + // last time, ignoring TouchUpdates and TouchEnd + testWidget.greenWidget->reset(); + testWidget.greenWidget->acceptTouchBegin = true; + // testWidget.greenWidget->acceptTouchUpdate = true; + // testWidget.greenWidget->acceptTouchEnd = true; + testWidget.greenWidget->closeWindowOnTouchEnd = true; + testWidget.showMaximized(); + + (void) qApp->exec(); + QVERIFY(testWidget.greenWidget->seenTouchBegin); + QVERIFY(testWidget.greenWidget->seenTouchUpdate); + QVERIFY(testWidget.greenWidget->seenTouchEnd); + QVERIFY(!testWidget.greenWidget->seenMousePress); + QVERIFY(!testWidget.greenWidget->seenMouseMove); + QVERIFY(!testWidget.greenWidget->seenMouseRelease); +} + +void tst_ManualMultitouch::touchEventPropagation() { + // first, make sure the greenWidget gets TouchBegin even though blueWidget is not touch aware MultitouchTestWidget testWidget; - testWidget.testNameLabel->setText("Touch event propagation"); - testWidget.testDescriptionLabel->setText("Touch, move, and release your finger over the green widget."); + testWidget.testNameLabel->setText("QTouchEvent propagation test"); + testWidget.testDescriptionLabel->setText("Touch, hold, and release your finger on the blue widget."); + testWidget.redWidget->hide(); + // testWidget.blueWidget->setAttribute(Qt::WA_AcceptTouchEvents); testWidget.greenWidget->setAttribute(Qt::WA_AcceptTouchEvents); testWidget.greenWidget->acceptTouchBegin = true; testWidget.greenWidget->acceptTouchUpdate = true; @@ -47,6 +143,36 @@ void tst_ManualMultitouch::touchBeginPropagation() testWidget.showMaximized(); (void) qApp->exec(); + QVERIFY(!testWidget.blueWidget->seenTouchBegin); + QVERIFY(!testWidget.blueWidget->seenTouchUpdate); + QVERIFY(!testWidget.blueWidget->seenTouchEnd); + QVERIFY(!testWidget.blueWidget->seenMousePress); + QVERIFY(!testWidget.blueWidget->seenMouseMove); + QVERIFY(!testWidget.blueWidget->seenMouseRelease); + QVERIFY(testWidget.greenWidget->seenTouchBegin); + QVERIFY(testWidget.greenWidget->seenTouchUpdate); + QVERIFY(testWidget.greenWidget->seenTouchEnd); + QVERIFY(!testWidget.greenWidget->seenMousePress); + QVERIFY(!testWidget.greenWidget->seenMouseMove); + QVERIFY(!testWidget.greenWidget->seenMouseRelease); + + // again, but this time blueWidget should see the TouchBegin + testWidget.blueWidget->reset(); + testWidget.greenWidget->reset(); + testWidget.blueWidget->setAttribute(Qt::WA_AcceptTouchEvents); + testWidget.greenWidget->acceptTouchBegin = true; + testWidget.greenWidget->acceptTouchUpdate = true; + testWidget.greenWidget->acceptTouchEnd = true; + testWidget.greenWidget->closeWindowOnTouchEnd = true; + testWidget.showMaximized(); + + (void) qApp->exec(); + QVERIFY(testWidget.blueWidget->seenTouchBegin); + QVERIFY(!testWidget.blueWidget->seenTouchUpdate); + QVERIFY(!testWidget.blueWidget->seenTouchEnd); + QVERIFY(!testWidget.blueWidget->seenMousePress); + QVERIFY(!testWidget.blueWidget->seenMouseMove); + QVERIFY(!testWidget.blueWidget->seenMouseRelease); QVERIFY(testWidget.greenWidget->seenTouchBegin); QVERIFY(testWidget.greenWidget->seenTouchUpdate); QVERIFY(testWidget.greenWidget->seenTouchEnd); @@ -63,6 +189,12 @@ void tst_ManualMultitouch::touchBeginPropagation() testWidget.showMaximized(); (void) qApp->exec(); + QVERIFY(testWidget.blueWidget->seenTouchBegin); + QVERIFY(!testWidget.blueWidget->seenTouchUpdate); + QVERIFY(!testWidget.blueWidget->seenTouchEnd); + QVERIFY(!testWidget.blueWidget->seenMousePress); + QVERIFY(!testWidget.blueWidget->seenMouseMove); + QVERIFY(!testWidget.blueWidget->seenMouseRelease); QVERIFY(testWidget.greenWidget->seenTouchBegin); QVERIFY(testWidget.greenWidget->seenTouchUpdate); QVERIFY(testWidget.greenWidget->seenTouchEnd); @@ -79,6 +211,12 @@ void tst_ManualMultitouch::touchBeginPropagation() testWidget.showMaximized(); (void) qApp->exec(); + QVERIFY(testWidget.blueWidget->seenTouchBegin); + QVERIFY(!testWidget.blueWidget->seenTouchUpdate); + QVERIFY(!testWidget.blueWidget->seenTouchEnd); + QVERIFY(!testWidget.blueWidget->seenMousePress); + QVERIFY(!testWidget.blueWidget->seenMouseMove); + QVERIFY(!testWidget.blueWidget->seenMouseRelease); QVERIFY(testWidget.greenWidget->seenTouchBegin); QVERIFY(testWidget.greenWidget->seenTouchUpdate); QVERIFY(testWidget.greenWidget->seenTouchEnd); @@ -95,6 +233,12 @@ void tst_ManualMultitouch::touchBeginPropagation() testWidget.showMaximized(); (void) qApp->exec(); + QVERIFY(testWidget.blueWidget->seenTouchBegin); + QVERIFY(!testWidget.blueWidget->seenTouchUpdate); + QVERIFY(!testWidget.blueWidget->seenTouchEnd); + QVERIFY(!testWidget.blueWidget->seenMousePress); + QVERIFY(!testWidget.blueWidget->seenMouseMove); + QVERIFY(!testWidget.blueWidget->seenMouseRelease); QVERIFY(testWidget.greenWidget->seenTouchBegin); QVERIFY(testWidget.greenWidget->seenTouchUpdate); QVERIFY(testWidget.greenWidget->seenTouchEnd); diff --git a/tests/manual/qtouchevent/touchwidget.cpp b/tests/manual/qtouchevent/touchwidget.cpp index 54ca685..1e57c36 100644 --- a/tests/manual/qtouchevent/touchwidget.cpp +++ b/tests/manual/qtouchevent/touchwidget.cpp @@ -1,9 +1,10 @@ #include "touchwidget.h" -#include <QMouseEvent> +#include <QApplication> +#include <QtEvents> +#include <QTimer> #include <QTouchEvent> - void TouchWidget::reset() { acceptTouchBegin @@ -69,7 +70,7 @@ bool TouchWidget::event(QEvent *event) case QEvent::MouseButtonRelease: seenMouseRelease = true; if (closeWindowOnMouseRelease) - window()->close(); + window()->close(); if (acceptMouseRelease) { event->accept(); return true; |