diff options
26 files changed, 1409 insertions, 1857 deletions
diff --git a/doc/src/diagrams/gestures/pangesture.svg b/doc/src/diagrams/gestures/pangesture.svg new file mode 100644 index 0000000..c5b95ca --- /dev/null +++ b/doc/src/diagrams/gestures/pangesture.svg @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="pangesture.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <linearGradient + id="linearGradient3198"> + <stop + style="stop-color:#c8c8e1;stop-opacity:1;" + offset="0" + id="stop3200" /> + <stop + style="stop-color:#e0e0e0;stop-opacity:0;" + offset="1" + id="stop3202" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective10" /> + <inkscape:perspective + id="perspective2473" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3198" + id="linearGradient3204" + x1="487.5" + y1="158.61218" + x2="487.5" + y2="171.11218" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-143.75,1.0517187e-5)" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="2" + inkscape:cx="297.42699" + inkscape:cy="855.02875" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:window-width="1184" + inkscape:window-height="668" + inkscape:window-x="152" + inkscape:window-y="228"> + <inkscape:grid + type="xygrid" + id="grid2383" + visible="true" + enabled="true" + units="pt" + spacingx="1pt" + spacingy="1pt" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3235" + width="275" + height="162.5" + x="137.5" + y="114.86218" + ry="25.253815" + rx="25.253815" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:5, 5;stroke-dashoffset:0;stroke-opacity:1" + id="path3167" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(62.5,18.75)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#c90000;stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path3169" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(206.25,18.75)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:5.625, 5.625;stroke-dashoffset:0;stroke-opacity:1" + d="M 200,183.61218 C 243.75,171.11218 300,171.11218 343.75,183.61218" + sodipodi:nodetypes="cc" + id="path12" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <g + id="g3214" + transform="translate(2.07835,-3.2783474)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72"> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 316.67165,230.64053 C 318.73754,225.81328 330.55722,234.70496 337.5,236.73718 L 337.5,189.86218 C 337.5,180.48718 346.875,180.48718 346.875,189.86218 L 346.875,222.67468 L 346.875,208.61218 C 346.875,203.92468 356.25,203.92468 356.25,208.61218 L 356.25,222.67468 L 356.25,213.29968 C 356.25,208.61218 365.625,208.61218 365.625,213.29968 L 365.625,227.36218 L 365.625,217.98718 C 365.625,213.29968 375,213.29968 375,217.98718 L 375,264.86218 C 365.625,269.54968 346.875,269.54968 337.5,264.86218 L 337.5,250.79968 C 331.50558,243.39877 314.0625,236.73718 316.67165,230.64053 z" + id="path2480" + sodipodi:nodetypes="ccccccccccccccccc" /> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.9375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 345.62962,192.2547 C 345.62962,188.66774 345.62962,185.08078 342.1875,185.08078 C 338.7454,185.08078 338.7454,188.66774 338.7454,192.2547 C 338.7454,195.84166 345.62962,195.84166 345.62962,192.2547 z" + id="path2478" + sodipodi:nodetypes="cccc" /> + </g> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + id="path3218" + d="M 165.625,142.98718 L 175,133.61218 L 184.375,142.98718 L 165.625,142.98718 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + sodipodi:nodetypes="cccc" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 193.75,139.86218 L 206.25,127.36218 L 218.75,139.86218 L 193.75,139.86218 z" + id="path3220" /> + <path + style="fill:none;fill-opacity:0.75000000000000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 143.75,164.86218 L 175,133.61218 L 187.5,146.11218 L 206.25,127.36218 L 243.75,164.86218" + id="path3157" + sodipodi:nodetypes="ccccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + id="path3222" + d="M 237.5,146.11218 L 243.75,139.86218 L 250,146.11218 L 237.5,146.11218 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + sodipodi:nodetypes="cccc" /> + <path + style="fill:none;fill-opacity:0.75000000000000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 231.25,152.36218 L 243.75,139.86218 L 256.25,152.36218" + id="path3159" + sodipodi:nodetypes="ccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="cc" + id="path3186" + d="M 175,158.61218 L 187.5,146.11218" + style="fill:none;fill-opacity:0.75000000000000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:url(#linearGradient3204);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 281.25,171.11218 L 318.75,133.61218 L 331.25,146.11218 L 350,127.36218 L 375,152.36218 L 387.5,139.86218 L 400,152.36218 L 400,171.11218" + id="path3196" + sodipodi:nodetypes="cccccccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + d="M 309.375,142.98718 L 318.75,133.61218 L 328.125,142.98718 L 309.375,142.98718 z" + id="path3182" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + id="path3184" + d="M 337.5,139.86218 L 350,127.36218 L 362.5,139.86218 L 337.5,139.86218 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + sodipodi:nodetypes="cccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="cccc" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + d="M 381.25,146.11218 L 387.5,139.86218 L 393.75,146.11218 L 381.25,146.11218 z" + id="path3188" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="ccccc" + id="path3208" + d="M 287.5,164.86218 L 318.75,133.61218 L 331.25,146.11218 L 350,127.36218 L 387.5,164.86218" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="ccc" + id="path3210" + d="M 375,152.36218 L 387.5,139.86218 L 400,152.36218" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 318.75,158.61218 L 331.25,146.11218" + id="path3212" + sodipodi:nodetypes="cc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + </g> +</svg> diff --git a/doc/src/diagrams/gestures/pinchgesture.svg b/doc/src/diagrams/gestures/pinchgesture.svg new file mode 100644 index 0000000..1c520b9 --- /dev/null +++ b/doc/src/diagrams/gestures/pinchgesture.svg @@ -0,0 +1,341 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="pinchgesture.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective10" /> + <inkscape:perspective + id="perspective2473" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3362" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3429" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3639" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.979899" + inkscape:cx="299.95763" + inkscape:cy="879.65793" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:window-width="1184" + inkscape:window-height="668" + inkscape:window-x="223" + inkscape:window-y="324"> + <inkscape:grid + type="xygrid" + id="grid2383" + visible="true" + enabled="true" + units="pt" + spacingx="1pt" + spacingy="1pt" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3235" + width="275" + height="162.5" + x="137.5" + y="114.86218" + ry="25.253815" + rx="25.253815" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <rect + ry="0" + rx="0" + y="127.36218" + x="168.75" + height="81.25" + width="212.5" + id="rect3839" + style="opacity:1;fill:#4040a0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#008000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 168.75,158.61218 C 200,164.86218 243.75,164.86218 275,171.11218 C 293.75,164.86218 356.25,158.61218 381.25,158.61218 L 381.25,208.61218 L 256.25,208.61218 L 168.75,208.61218 L 168.75,158.61218 z" + id="path3845" + sodipodi:nodetypes="ccccccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <rect + style="opacity:1;fill:#404060;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93750000000000000;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3328" + width="75" + height="56.25" + x="237.5" + y="139.86218" + rx="0" + ry="0" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#2f4f2f;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 312.5,164.86218 C 306.25,158.61218 281.25,171.11218 262.5,164.86218 C 247.30507,158.35772 243.75,164.86218 237.5,171.11218 L 237.5,196.11218 L 312.5,196.11218 L 312.5,164.86218 z" + id="path3841" + sodipodi:nodetypes="cccccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:0.12437811;fill-rule:evenodd;stroke:#000000;stroke-width:2.50000000000000000;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:5, 5;stroke-dashoffset:0;stroke-opacity:1" + id="path3167" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(118.75,0)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:0;fill-rule:evenodd;stroke:#c90000;stroke-width:2.50000000000000000;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path3169" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(225.5176,19.302421)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + transform="translate(50,-6.25)" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + sodipodi:ry="12.5" + sodipodi:rx="12.5" + sodipodi:cy="164.86218" + sodipodi:cx="137.5" + id="path3649" + style="opacity:1;fill:#ffffff;fill-opacity:0;fill-rule:evenodd;stroke:#c90000;stroke-width:2.50000000000000000;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + sodipodi:type="arc" /> + <g + id="g3641" + inkscape:label="Layer 1" + transform="matrix(-0.75,0,0,0.75,585.42164,37.937193)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72"> + <g + id="g3643"> + <path + sodipodi:nodetypes="ccccccccccccccccc" + id="path3645" + d="M 497.22886,219.23332 C 499.98338,212.79698 515.74295,224.65256 525,227.36218 L 525,164.86218 C 525,152.36218 537.5,152.36218 537.5,164.86218 L 537.5,208.61218 L 537.5,189.86218 C 537.5,183.61218 550,183.61218 550,189.86218 L 550,208.61218 L 550,196.11218 C 550,189.86218 562.5,189.86218 562.5,196.11218 L 562.5,214.86218 L 562.5,202.36218 C 562.5,196.11218 575,196.11218 575,202.36218 L 575,264.86218 C 562.5,271.11218 537.5,271.11218 525,264.86218 L 525,246.11218 C 517.00744,236.2443 493.75,227.36218 497.22886,219.23332 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + sodipodi:nodetypes="cccc" + id="path3647" + d="M 535.83948,168.05221 C 535.83948,163.26959 535.83948,158.48698 531.25,158.48698 C 526.66052,158.48698 526.66052,163.26959 526.66052,168.05221 C 526.66052,172.83482 535.83948,172.83482 535.83948,168.05221 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + </g> + </g> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:5.625, 5.625;stroke-dashoffset:0;stroke-opacity:1" + d="M 187.5,158.61218 L 256.25,164.86218" + sodipodi:nodetypes="cc" + id="path12" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + transform="translate(156.25,6.25)" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + sodipodi:ry="12.5" + sodipodi:rx="12.5" + sodipodi:cy="164.86218" + sodipodi:cx="137.5" + id="path3659" + style="opacity:1;fill:#ffffff;fill-opacity:0.12437811;fill-rule:evenodd;stroke:#000000;stroke-width:2.50000000000000000;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:5, 5;stroke-dashoffset:0;stroke-opacity:1" + sodipodi:type="arc" /> + <path + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + id="path3661" + sodipodi:nodetypes="cc" + d="M 293.75,171.11218 L 362.5,183.61218" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:5.625, 5.625;stroke-dashoffset:0;stroke-opacity:1" /> + <g + id="g3431" + inkscape:label="Layer 1" + transform="matrix(0.7386058,0.1302361,-0.1302361,0.7386058,-8.1572814,-2.6927947)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72"> + <g + id="g3210"> + <path + sodipodi:nodetypes="ccccccccccccccccc" + id="path3191" + d="M 497.22886,219.23332 C 499.98338,212.79698 515.74295,224.65256 525,227.36218 L 525,164.86218 C 525,152.36218 537.5,152.36218 537.5,164.86218 L 537.5,208.61218 L 537.5,189.86218 C 537.5,183.61218 550,183.61218 550,189.86218 L 550,208.61218 L 550,196.11218 C 550,189.86218 562.5,189.86218 562.5,196.11218 L 562.5,214.86218 L 562.5,202.36218 C 562.5,196.11218 575,196.11218 575,202.36218 L 575,264.86218 C 562.5,271.11218 537.5,271.11218 525,264.86218 L 525,246.11218 C 517.00744,236.2443 493.75,227.36218 497.22886,219.23332 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + sodipodi:nodetypes="cccc" + id="path3197" + d="M 535.83948,168.05221 C 535.83948,163.26959 535.83948,158.48698 531.25,158.48698 C 526.66052,158.48698 526.66052,163.26959 526.66052,168.05221 C 526.66052,172.83482 535.83948,172.83482 535.83948,168.05221 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + </g> + </g> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 312.5,171.11218 L 356.25,171.11218" + id="path3847" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#c44060;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 362.5,171.11218 L 362.5,139.86218 L 312.5,139.86218 L 312.5,171.11218 L 362.5,171.11218 z" + id="path3849" + sodipodi:nodetypes="cccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 368.75,139.86218 L 356.25,127.36218 L 318.75,127.36218 L 306.25,139.86218 L 368.75,139.86218 z" + id="path3853" + sodipodi:nodetypes="ccccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="cccc" + id="path3855" + d="M 331.25,158.61218 L 331.25,146.11218 L 318.75,146.11218 L 318.75,158.61218 L 331.25,158.61218 z" + style="fill:#5b77ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#c0cb54;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 356.25,171.11218 L 356.25,146.11218 L 343.75,146.11218 L 343.75,171.11218 L 356.25,171.11218 z" + id="path3857" + sodipodi:nodetypes="ccccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + id="path3868" + d="M 282.8125,167.98719 L 293.75,167.98719" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.25px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="cccc" + id="path3870" + d="M 295.3125,167.98719 L 295.3125,160.17469 L 282.8125,160.17469 L 282.8125,167.98719 L 295.3125,167.98719 z" + style="fill:#681e2f;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.25000000000000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="ccccc" + id="path3872" + d="M 296.875,160.17469 L 293.75,157.04969 L 284.375,157.04969 L 281.25,160.17469 L 296.875,160.17469 z" + style="fill:#6e6c6c;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.25000000000000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:#2f3e85;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.31250000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 287.5,164.86219 L 287.5,161.73719 L 284.375,161.73719 L 284.375,164.86219 L 287.5,164.86219 z" + id="path3874" + sodipodi:nodetypes="cccc" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:nodetypes="ccccc" + id="path3876" + d="M 293.75,167.98719 L 293.75,161.73719 L 290.625,161.73719 L 290.625,167.98719 L 293.75,167.98719 z" + style="fill:#65692a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.31250000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pinchgesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + </g> +</svg> diff --git a/doc/src/diagrams/gestures/swipegesture-details.svg b/doc/src/diagrams/gestures/swipegesture-details.svg new file mode 100644 index 0000000..0f7de5b --- /dev/null +++ b/doc/src/diagrams/gestures/swipegesture-details.svg @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="swipegesture-details.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective10" /> + <inkscape:perspective + id="perspective2473" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3362" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3429" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4" + inkscape:cx="321.9787" + inkscape:cy="855.02875" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:window-width="1184" + inkscape:window-height="668" + inkscape:window-x="152" + inkscape:window-y="228"> + <inkscape:grid + type="xygrid" + id="grid2383" + visible="true" + enabled="true" + units="pt" + spacingx="1pt" + spacingy="1pt" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3235" + width="275" + height="162.5" + x="137.5" + y="114.86218" + ry="25.253815" + rx="25.253815" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:5, 5;stroke-dashoffset:0;stroke-opacity:1" + id="path3167" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(43.75,-25)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#c90000;stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path3169" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(218.75,18.75)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:5.625, 5.625;stroke-dashoffset:0;stroke-opacity:1" + d="M 181.25,139.86218 L 356.25,183.61218" + sodipodi:nodetypes="cc" + id="path12" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <g + id="g3431" + inkscape:label="Layer 1" + transform="matrix(0.7386058,0.1302361,-0.1302361,0.7386058,-15.203718,-5.6523172)"> + <g + id="g3210"> + <path + sodipodi:nodetypes="ccccccccccccccccc" + id="path3191" + d="M 497.22886,219.23332 C 499.98338,212.79698 515.74295,224.65256 525,227.36218 L 525,164.86218 C 525,152.36218 537.5,152.36218 537.5,164.86218 L 537.5,208.61218 L 537.5,189.86218 C 537.5,183.61218 550,183.61218 550,189.86218 L 550,208.61218 L 550,196.11218 C 550,189.86218 562.5,189.86218 562.5,196.11218 L 562.5,214.86218 L 562.5,202.36218 C 562.5,196.11218 575,196.11218 575,202.36218 L 575,264.86218 C 562.5,271.11218 537.5,271.11218 525,264.86218 L 525,246.11218 C 517.00744,236.2443 493.75,227.36218 497.22886,219.23332 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + sodipodi:nodetypes="cccc" + id="path3197" + d="M 535.83948,168.05221 C 535.83948,163.26959 535.83948,158.48698 531.25,158.48698 C 526.66052,158.48698 526.66052,163.26959 526.66052,168.05221 C 526.66052,172.83482 535.83948,172.83482 535.83948,168.05221 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + </g> + </g> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 181.25,139.86218 L 356.25,139.86218" + id="path3436" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 287.5,139.86218 C 287.5,146.11218 287.5,158.61218 281.25,164.86218" + id="path3438" + sodipodi:nodetypes="cc" /> + </g> +</svg> diff --git a/doc/src/diagrams/gestures/swipegesture.svg b/doc/src/diagrams/gestures/swipegesture.svg new file mode 100644 index 0000000..fc60a4d --- /dev/null +++ b/doc/src/diagrams/gestures/swipegesture.svg @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="swipegesture.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective10" /> + <inkscape:perspective + id="perspective2473" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3362" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3429" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4" + inkscape:cx="321.9787" + inkscape:cy="855.02875" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:window-width="1184" + inkscape:window-height="668" + inkscape:window-x="152" + inkscape:window-y="228"> + <inkscape:grid + type="xygrid" + id="grid2383" + visible="true" + enabled="true" + units="pt" + spacingx="1pt" + spacingy="1pt" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3235" + width="275" + height="162.5" + x="137.5" + y="114.86218" + ry="25.253815" + rx="25.253815" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:5, 5;stroke-dashoffset:0;stroke-opacity:1" + id="path3167" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(43.75,-25)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#c90000;stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path3169" + sodipodi:cx="137.5" + sodipodi:cy="164.86218" + sodipodi:rx="12.5" + sodipodi:ry="12.5" + d="M 150,164.86218 A 12.5,12.5 0 1 1 125,164.86218 A 12.5,12.5 0 1 1 150,164.86218 z" + transform="translate(218.75,18.75)" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1.875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:5.625, 5.625;stroke-dashoffset:0;stroke-opacity:1" + d="M 181.25,139.86218 L 356.25,183.61218" + sodipodi:nodetypes="cc" + id="path12" + inkscape:export-filename="/home/dboddie/git/qt/doc/src/images/pangesture.png" + inkscape:export-xdpi="72" + inkscape:export-ydpi="72" /> + <g + id="g3431" + inkscape:label="Layer 1" + transform="matrix(0.7386058,0.1302361,-0.1302361,0.7386058,-15.203718,-5.6523172)"> + <g + id="g3210"> + <path + sodipodi:nodetypes="ccccccccccccccccc" + id="path3191" + d="M 497.22886,219.23332 C 499.98338,212.79698 515.74295,224.65256 525,227.36218 L 525,164.86218 C 525,152.36218 537.5,152.36218 537.5,164.86218 L 537.5,208.61218 L 537.5,189.86218 C 537.5,183.61218 550,183.61218 550,189.86218 L 550,208.61218 L 550,196.11218 C 550,189.86218 562.5,189.86218 562.5,196.11218 L 562.5,214.86218 L 562.5,202.36218 C 562.5,196.11218 575,196.11218 575,202.36218 L 575,264.86218 C 562.5,271.11218 537.5,271.11218 525,264.86218 L 525,246.11218 C 517.00744,236.2443 493.75,227.36218 497.22886,219.23332 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + sodipodi:nodetypes="cccc" + id="path3197" + d="M 535.83948,168.05221 C 535.83948,163.26959 535.83948,158.48698 531.25,158.48698 C 526.66052,158.48698 526.66052,163.26959 526.66052,168.05221 C 526.66052,172.83482 535.83948,172.83482 535.83948,168.05221 z" + style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + </g> + </g> + </g> +</svg> diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 158a273..a619fe8 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -41,10 +41,9 @@ /*! \page gestures-overview.html - \startpage index.html Qt Reference Documentation - \title Gestures Programming \ingroup frameworks-technologies + \startpage index.html Qt Reference Documentation \brief An overview of the Qt support for Gesture programming. @@ -59,176 +58,116 @@ \section1 Overview - QGesture is the central class in Qt's gesture framework, providing - the API used by classes that represent specific gestures, such as - QPanGesture, QPinchGesture, and QSwipeGesture. These standard - classes are ready to use, and each exposes functions and - properties that give gesture-specific information about the user's - input. This is described in the \l{Using Standard Gestures With Widgets} - section. - - QGesture is also designed to be subclassed and extended so that - support for new gestures can be implemented by developers. Adding - support for a new gesture involves implementing code to recognize - the gesture from incoming events. This is described in the + QGesture is the central class in Qt's gesture framework, providing a container + for information about gestures performed by the user. QGesture exposes + properties that give general information that is common to all gestures, and + these can be extended to provide additional gesture-specific information. + Common panning, pinching and swiping gestures are represented by specialized + classes: QPanGesture, QPinchGesture and QSwipeGesture. + + Developers can also implement new gestures by subclassing and extending the + QGestureRecognizer class. Adding support for a new gesture involves implementing + code to recognize the gesture from input events. This is described in the \l{Creating Your Own Gesture Recognizer} section. \section1 Using Standard Gestures with Widgets - Gesture objects are applied directly to widgets and other controls that accept - user input \mdash these are the \e{target objects}. When a gesture object is - constructed, the target object is typically passed to the constructor, though - it can also be passed as the argument to the \l{QGesture::}{setGestureTarget()} - function. + Gestures can be enabled for instances of QWidget and QGraphicsObject subclasses. + An object that accepts gesture input is referred to as a \e{target object}. + + To enable a gesture for a target object, call its QWidget::grabGesture() or + QGraphicsObject::grabGesture() function with an argument describing the + required gesture type. The standard types are defined by the Qt::GestureType + enum and include many commonly used gestures. - \snippet examples/gestures/imageviewer/imagewidget.cpp construct swipe gesture + \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures In the above code, the gesture is set up in the constructor of the target object - itself, so the argument to the QSwipeGesture constructor is \e this. + itself. + + When the user performs a gesture, QGestureEvent events will be delivered to the + target object, and these can be handled by reimplementing the QWidget::event() + handler function for widgets or QGraphicsItem::sceneEvent() for graphics objects. - When the user performs a gesture, various signals may be emitted by the - gesture object. To monitor the user's actions, you need to connect signals - from the gesture object to slots in your code. + For convenience, the \l{Image Gestures Example} reimplements the general + \l{QWidget::}{event()} handler function and delegates gesture events to a + specialized gestureEvent() function: - \snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture + \snippet examples/gestures/imagegestures/imagewidget.cpp event handler - Here, the \l{QGesture::}{triggered()} signal is used to inform the application - that a gesture was used. More precise monitoring of a gesture can be implemented - by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and - \l{QGesture::}{finished()} signals to slots. + The gesture events delivered to the target object can be examined individually + and dealt with appropriately: - Responding to a signal is simply a matter of obtaining the gesture that sent - it and examining the information it contains. + \snippet examples/gestures/imagegestures/imagewidget.cpp gesture event handler - \snippet examples/gestures/imageviewer/imagewidget.cpp swipe slot start + Responding to a gesture is simply a matter of obtaining the QGesture object + delivered in the QGestureEvent sent to the target object and examining the + information it contains. + + \snippet examples/gestures/imagegestures/imagewidget.cpp swipe function Here, we examine the direction in which the user swiped the widget and modify its contents accordingly. - \section1 Using Standard Gestures with Graphics Items - - The approach used for applying gestures to widgets can also be used with - graphics items. However, instead of passing a target object to the - gesture object's constructor, you set a target graphics item with the - \l{QGesture::}{setGraphicsItem()} function. \section1 Creating Your Own Gesture Recognizer - QGesture is a base class for a user defined gesture recognizer class. In - order to implement the recognizer you will need to subclass the - QGesture class and implement the pure virtual function - \l{QGesture::}{filterEvent()} to filter out events that are not relevant - to your gesture. - - Once you have implemented the \l{QGesture::}{filterEvent()} function to - make your own recognizer you can process events. A sequence of events may, - according to your own rules, represent a gesture. The events can be singly - passed to the recognizer via the \l{QGesture::}{filterEvent()} function - or as a stream of events by specifying a parent source of events. The events - can be from any source and could result in any action as defined by the user. - The source and action need not be graphical, though that would be the most - likely scenario. To find how to connect a source of events to automatically - feed into the recognizer see the QGesture documentation. - - Recognizers based on QGesture can emit any of the following signals to - indicate their progress in recognizing user input: - - \list - \o \l{QGesture::}{triggered()} is emitted when a gesture is recognized. - \o \l{QGesture::}{started()} indicates that the gesture object has started - to recognize user input. - \o \l{QGesture::}{finished()} is emitted when the gesture object has - recognized the user input as a gesture, and finished handling it. - \o \l{QGesture::}{canceled()} indicates that the gesture was canceled, - either by the user or by the application. - \endlist - - These signals are emitted when the state changes with the call to - \l{QGesture::}{updateState()}, more than one signal may - be emitted when a change of state occurs. There are four GestureStates - - \table - \header \o New State \o Description \o QGesture Actions on Entering this State - \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{canceled()} - \row \o Qt::GestureStarted \o A continuous gesture has started \o emit \l{QGesture::}{started()} and emit \l{QGesture::}{triggered()} - \row \o Qt::GestureUpdated \o A gesture continues \o emit \l{QGesture::}{triggered()} - \row \o Qt::GestureFinished \o A gesture has finished. \o emit \l{QGesture::}{finished()} - \endtable - - \note \l{QGesture::started()}{started()} can be emitted if entering any - state greater than NoGesture if NoGesture was the previous state. This - means that your state machine does not need to explicitly use the - Qt::GestureStarted state, you can simply proceed from NoGesture to - Qt::GestureUpdated to emit a \l{QGesture::started()}{started()} signal - and a \l{QGesture::triggered()}{triggered()} signal. - - You may use some or all of these states when implementing the pure - virtual function \l{QGesture::filterEvent()}{filterEvent()}. - \l{QGesture::filterEvent()}{filterEvent()} will usually implement a - state machine using the GestureState enums, but the details of which - states are used is up to the developer. - - You may also need to reimplement the virtual function \l{QGesture::reset()}{reset()} - if internal data or objects need to be re-initialized. The function must - conclude with a call to \l{QGesture::updateState()}{updateState()} to - change the current state to Qt::NoGesture. - - \section1 The ImageViewer Example - - To illustrate how to use QGesture we will look at the ImageViewer - example. This example uses QPanGesture, a standard gesture, and an - implementation of TapAndHoldGesture. Note that TapAndHoldGesture is - platform-dependent. - - \snippet doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp tapandhold-reset - - In ImageViewer we see that the ImageWidget class uses two gestures: - \l QPanGesture and TapAndHoldGesture. The - QPanGesture is a standard gesture which is part of Qt. - TapAndHoldGesture is defined and implemented as part of the example. - The ImageWidget listens for signals from the gestures, but is not - interested in the \l{QGesture::started()}{started()} signal. - - \snippet doc/src/snippets/gestures/imageviewer/imagewidget.h imagewidget-slots - - TapAndHoldGesture uses QTouchEvent events and mouse events to detect - start, update and end events that can be mapped onto the GestureState - changes. The implementation in this case uses a timer as well. If the - timeout event occurs a given number of times after the start of the gesture - then the gesture is considered to have finished whether or not the - appropriate touch or mouse event has occurred. Also if a large jump in - the position of the event occurs, as calculated by the \l {QPoint::manhattanLength()}{manhattanLength()} - call, then the gesture is canceled by calling \l{QGesture::reset()}{reset()} - which tidies up and uses \l{QGesture::updateState()}{updateState()} to - change state to NoGesture which will result in the \l{QGesture::canceled()}{canceled()} - signal being emitted by the recognizer. - - ImageWidget handles the signals by connecting the slots to the signals, - although \c canceled() is not connected here. - - \snippet doc/src/snippets/gestures/imageviewer/imagewidget.cpp imagewidget-connect - - These functions in turn will have to be aware of which gesture - object was the source of the signal since we have more than one source - per slot. This is easily done by using the QObject::sender() function - as shown here - - \snippet doc/src/snippets/gestures/imageviewer/imagewidget.cpp imagewidget-triggered-1 - - As \l{QGesture::triggered()}{triggered()} signals are handled by - gestureTriggered() there may be position updates invoking calls to, - for example, goNextImage(), this will cause a change in the image - handling logic of ImageWidget and a call to updateImage() to display - the changed state. - - Following the logic of how the QEvent is processed we can summmarize - it as follows: - \list - \o filterEvent() becomes the event filter of the parent ImageWidget object - for a QPanGesture object and a TapAndHoldGesture object. - \o filterEvent() then calls updateState() to change states - \o updateState() emits the appropriate signal(s) for the state change. - \o The signals are caught by the defined slots in ImageWidget - \o The widget logic changes and an update() results in a paint event. - \endlist + Adding support for a new gesture involves creating and registering a new gesture + recognizer. Depending on the recognition process for the gesture, it may also + involve creating a new gesture object. + + To create a new recognizer, you need to subclass QGestureRecognizer to create a + custom recognizer class. There is one virtual function that you must reimplement + and two others that can be reimplemented as required. + + \section2 Filtering Input Events + + The \l{QGestureRecognizer::}{filterEvent()} function must be reimplemented. + This function handles and filters the incoming input events for the target objects + and determines whether or not they correspond to the gesture the recognizer is + looking for. + + Although the logic for gesture recognition is implemented in this function, + possibly using a state machine based on the Qt::GestureState enums, you can store + persistent information about the state of the recognition process in the QGesture + object supplied. + + Your \l{QGestureRecognizer::}{filterEvent()} function must return a value of + Qt::GestureState that indicates the state of recognition for a given gesture and + target object. This determines whether or not a gesture event will be delivered + to a target object. + + \section2 Custom Gestures + + If you choose to represent a gesture by a custom QGesture subclass, you will need to + reimplement the \l{QGestureRecognizer::}{createGesture()} function to construct + instances of your gesture class instead of standard QGesture instances. Alternatively, + you may want to use standard QGesture instances, but add additional dynamic properties + to them to express specific details of the gesture you want to handle. + + \section2 Resetting Gestures + + If you use custom gesture objects that need to be reset or otherwise specially + handled when a gesture is canceled, you need to reimplement the + \l{QGestureRecognizer::}{reset()} function to perform these special tasks. + + Note that QGesture objects are only created once for each combination of target object + and gesture type, and they are reused every time the user attempts to perform the + same gesture type on the target object. As a result, it can be useful to reimplement + the \l{QGestureRecognizer::}{reset()} function to clean up after each previous attempt + at recognizing a gesture. + + + \section1 Using a New Gesture Recognizer + + To use a gesture recognizer, construct an instance of your QGestureRecognizer + subclass, and register it with the application with + QApplication::registerGestureRecognizer(). A recognizer for a given type of + gesture can be removed with QApplication::unregisterGestureRecognizer(). + + + \section1 Further Reading + + The \l{Image Gestures Example} shows how to enable gestures for a widget in + a simple image viewer application. */ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index d6ade22..05940e4 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -1072,18 +1072,17 @@ /*! \page examples-gestures.html \title Gestures Examples - + \previouspage Animation Framework Examples \contentspage Qt Examples \nextpage D-Bus Examples The API of the gesture framework is not yet finalized and still subject to change. -\omit + \list - \o \l{widgets/imageviewer}{Image Viewer} + \o \l{gestures/imagegestures}{Image Gestures} \endlist -\endomit */ /*! diff --git a/doc/src/images/pangesture.png b/doc/src/images/pangesture.png Binary files differnew file mode 100644 index 0000000..24caf91 --- /dev/null +++ b/doc/src/images/pangesture.png diff --git a/doc/src/images/pinchgesture.png b/doc/src/images/pinchgesture.png Binary files differnew file mode 100644 index 0000000..95614c4 --- /dev/null +++ b/doc/src/images/pinchgesture.png diff --git a/doc/src/images/swipegesture.png b/doc/src/images/swipegesture.png Binary files differnew file mode 100644 index 0000000..0b7d35a --- /dev/null +++ b/doc/src/images/swipegesture.png diff --git a/doc/src/snippets/gestures/imageviewer/imagewidget.cpp b/doc/src/snippets/gestures/imageviewer/imagewidget.cpp deleted file mode 100644 index 409db2e..0000000 --- a/doc/src/snippets/gestures/imageviewer/imagewidget.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "imagewidget.h" - -#include <QtGui> - -ImageWidget::ImageWidget(QWidget *parent) - : QWidget(parent) -{ - setAttribute(Qt::WA_AcceptTouchEvents); - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - - setObjectName("ImageWidget"); - - setMinimumSize(QSize(100,100)); - - position = 0; - zoomed = rotated = false; - - zoomedIn = false; - horizontalOffset = 0; - verticalOffset = 0; - -//! [imagewidget-connect] - panGesture = new QPanGesture(this); - connect(panGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); - - tapAndHoldGesture = new TapAndHoldGesture(this); - connect(tapAndHoldGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); - connect(tapAndHoldGesture, SIGNAL(finished()), this, SLOT(gestureFinished())); -//! [imagewidget-connect] -} - -void ImageWidget::paintEvent(QPaintEvent*) -{ - QPainter p(this); - if (currentImage.isNull()) { - p.fillRect(geometry(), Qt::white); - return; - } - int hoffset = 0; - int voffset = 0; - const int w = pixmap.width(); - const int h = pixmap.height(); - p.save(); - if (zoomedIn) { - hoffset = horizontalOffset; - voffset = verticalOffset; - if (horizontalOffset > 0) - p.fillRect(0, 0, horizontalOffset, height(), Qt::white); - if (verticalOffset > 0) - p.fillRect(0, 0, width(), verticalOffset, Qt::white); - } - p.drawPixmap(hoffset, voffset, pixmap); - if (hoffset + w < width()) - p.fillRect(hoffset + w, 0, width() - w - hoffset, height(), Qt::white); - if (voffset + h < height()) - p.fillRect(0, voffset + h, width(), height() - h - voffset, Qt::white); - - // paint touch feedback - if (touchFeedback.tapped || touchFeedback.doubleTapped) { - p.setPen(QPen(Qt::gray, 2)); - p.drawEllipse(touchFeedback.position, 5, 5); - if (touchFeedback.doubleTapped) { - p.setPen(QPen(Qt::darkGray, 2, Qt::DotLine)); - p.drawEllipse(touchFeedback.position, 15, 15); - } else if (touchFeedback.tapAndHoldState != 0) { - QPoint pts[8] = { - touchFeedback.position + QPoint( 0, -15), - touchFeedback.position + QPoint( 10, -10), - touchFeedback.position + QPoint( 15, 0), - touchFeedback.position + QPoint( 10, 10), - touchFeedback.position + QPoint( 0, 15), - touchFeedback.position + QPoint(-10, 10), - touchFeedback.position + QPoint(-15, 0) - }; - for (int i = 0; i < touchFeedback.tapAndHoldState/5; ++i) - p.drawEllipse(pts[i], 3, 3); - } - } else if (touchFeedback.sliding) { - p.setPen(QPen(Qt::red, 3)); - QPoint endPos = QPoint(touchFeedback.position.x(), touchFeedback.slidingStartPosition.y()); - p.drawLine(touchFeedback.slidingStartPosition, endPos); - int dx = 10; - if (touchFeedback.slidingStartPosition.x() < endPos.x()) - dx = -1*dx; - p.drawLine(endPos, endPos + QPoint(dx, 5)); - p.drawLine(endPos, endPos + QPoint(dx, -5)); - } - - for (int i = 0; i < TouchFeedback::MaximumNumberOfTouches; ++i) { - if (touchFeedback.touches[i].isNull()) - break; - p.drawEllipse(touchFeedback.touches[i], 10, 10); - } - p.restore(); -} - -void ImageWidget::mousePressEvent(QMouseEvent *event) -{ - touchFeedback.tapped = true; - touchFeedback.position = event->pos(); -} - -void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event) -{ - touchFeedback.doubleTapped = true; - const QPoint p = event->pos(); - touchFeedback.position = p; - horizontalOffset = p.x() - currentImage.width()*1.0*p.x()/width(); - verticalOffset = p.y() - currentImage.height()*1.0*p.y()/height(); - setZoomedIn(!zoomedIn); - zoomed = rotated = false; - updateImage(); - - feedbackFadeOutTimer.start(500, this); -} - -//! [imagewidget-triggered-1] -void ImageWidget::gestureTriggered() -{ - if (sender() == panGesture) { -//! [imagewidget-triggered-1] - touchFeedback.tapped = false; - touchFeedback.doubleTapped = false; - QPanGesture *pg = qobject_cast<QPanGesture*>(sender()); - if (zoomedIn) { -#ifndef QT_NO_CURSOR - switch (pg->state()) { - case Qt::GestureStarted: - case Qt::GestureUpdated: - setCursor(Qt::SizeAllCursor); - break; - default: - setCursor(Qt::ArrowCursor); - } -#endif - horizontalOffset += pg->lastOffset().width(); - verticalOffset += pg->lastOffset().height(); - } else { - // only slide gesture should be accepted - if (pg->state() == Qt::GestureFinished) { - touchFeedback.sliding = false; - zoomed = rotated = false; - if (pg->totalOffset().width() > 0) - goNextImage(); - else - goPrevImage(); - updateImage(); - } - } - update(); - feedbackFadeOutTimer.start(500, this); - } else if (sender() == tapAndHoldGesture) { - if (tapAndHoldGesture->state() == Qt::GestureFinished) { - qDebug() << "tap and hold detected"; - touchFeedback.reset(); - update(); - - QMenu menu; - menu.addAction("Action 1"); - menu.addAction("Action 2"); - menu.addAction("Action 3"); - menu.exec(mapToGlobal(tapAndHoldGesture->pos())); - } else { - ++touchFeedback.tapAndHoldState; - update(); - } - feedbackFadeOutTimer.start(500, this); - } -} - -void ImageWidget::gestureFinished() -{ - qDebug() << "gesture finished" << sender(); -} - -void ImageWidget::gestureCancelled() -{ - qDebug() << "gesture cancelled" << sender(); -} - -void ImageWidget::resizeEvent(QResizeEvent*) -{ - updateImage(); -} - -void ImageWidget::updateImage() -{ - // should use qtconcurrent here? - transformation = QTransform(); - if (zoomedIn) { - } else { - if (currentImage.isNull()) - return; - if (zoomed) { - transformation = transformation.scale(zoom, zoom); - } else { - double xscale = (double)width()/currentImage.width(); - double yscale = (double)height()/currentImage.height(); - if (xscale < yscale) - yscale = xscale; - else - xscale = yscale; - transformation = transformation.scale(xscale, yscale); - } - if (rotated) - transformation = transformation.rotate(angle); - } - pixmap = QPixmap::fromImage(currentImage).transformed(transformation); - update(); -} - -void ImageWidget::openDirectory(const QString &path) -{ - this->path = path; - QDir dir(path); - QStringList nameFilters; - nameFilters << "*.jpg" << "*.png"; - files = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name); - - position = 0; - goToImage(0); - updateImage(); -} - -QImage ImageWidget::loadImage(const QString &fileName) -{ - QImageReader reader(fileName); - if (!reader.canRead()) { - qDebug() << fileName << ": can't load image"; - return QImage(); - } - QImage image; - if (!reader.read(&image)) { - qDebug() << fileName << ": corrupted image"; - return QImage(); - } - return image; -} - -void ImageWidget::setZoomedIn(bool zoomed) -{ - zoomedIn = zoomed; -} - -void ImageWidget::goNextImage() -{ - if (files.isEmpty()) - return; - if (position < files.size()-1) { - ++position; - prevImage = currentImage; - currentImage = nextImage; - if (position+1 < files.size()) - nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); - else - nextImage = QImage(); - } - setZoomedIn(false); - updateImage(); -} - -void ImageWidget::goPrevImage() -{ - if (files.isEmpty()) - return; - if (position > 0) { - --position; - nextImage = currentImage; - currentImage = prevImage; - if (position > 0) - prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); - else - prevImage = QImage(); - } - setZoomedIn(false); - updateImage(); -} - -void ImageWidget::goToImage(int index) -{ - if (files.isEmpty()) - return; - if (index < 0 || index >= files.size()) { - qDebug() << "goToImage: invalid index: " << index; - return; - } - if (index == position+1) { - goNextImage(); - return; - } - if (position > 0 && index == position-1) { - goPrevImage(); - return; - } - position = index; - pixmap = QPixmap(); - if (index > 0) - prevImage = loadImage(path+QLatin1String("/")+files.at(position-1)); - else - prevImage = QImage(); - currentImage = loadImage(path+QLatin1String("/")+files.at(position)); - if (position+1 < files.size()) - nextImage = loadImage(path+QLatin1String("/")+files.at(position+1)); - else - nextImage = QImage(); - setZoomedIn(false); - updateImage(); -} - -void ImageWidget::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == touchFeedback.tapTimer.timerId()) { - touchFeedback.tapTimer.stop(); - } else if (event->timerId() == feedbackFadeOutTimer.timerId()) { - feedbackFadeOutTimer.stop(); - touchFeedback.reset(); - } - update(); -} - -#include "moc_imagewidget.cpp" diff --git a/doc/src/snippets/gestures/imageviewer/imagewidget.h b/doc/src/snippets/gestures/imageviewer/imagewidget.h deleted file mode 100644 index 5553093..0000000 --- a/doc/src/snippets/gestures/imageviewer/imagewidget.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAGEWIDGET_H -#define IMAGEWIDGET_H - -#include <QWidget> -#include <QImage> -#include <QPixmap> - -#include <QtGui> - -#include "tapandholdgesture.h" - -class ImageWidget : public QWidget -{ - Q_OBJECT - -public: - ImageWidget(QWidget *parent = 0); - - void openDirectory(const QString &path); - -protected: - void paintEvent(QPaintEvent*); - void resizeEvent(QResizeEvent*); - void timerEvent(QTimerEvent*); - void mousePressEvent(QMouseEvent*); - void mouseDoubleClickEvent(QMouseEvent*); - -//! [imagewidget-slots] -private slots: - void gestureTriggered(); - void gestureFinished(); - void gestureCancelled(); -//! [imagewidget-slots] - -private: - void updateImage(); - QImage loadImage(const QString &fileName); - void loadImage(); - void setZoomedIn(bool zoomed); - void goNextImage(); - void goPrevImage(); - void goToImage(int index); - - QPanGesture *panGesture; - TapAndHoldGesture *tapAndHoldGesture; - - QString path; - QStringList files; - int position; - - QImage prevImage, nextImage; - QImage currentImage; - QPixmap pixmap; - QTransform transformation; - - bool zoomedIn; - int horizontalOffset; - int verticalOffset; - - bool zoomed; - qreal zoom; - bool rotated; - qreal angle; - - struct TouchFeedback - { - bool tapped; - QPoint position; - bool sliding; - QPoint slidingStartPosition; - QBasicTimer tapTimer; - int tapState; - bool doubleTapped; - int tapAndHoldState; - - enum { MaximumNumberOfTouches = 5 }; - QPoint touches[MaximumNumberOfTouches]; - - inline TouchFeedback() { reset(); } - inline void reset() - { - tapped = false; - sliding = false; - tapTimer.stop(); - tapState = 0; - doubleTapped = false; - tapAndHoldState = 0; - for (int i = 0; i < MaximumNumberOfTouches; ++i) { - touches[i] = QPoint(); - } - } - } touchFeedback; - QBasicTimer feedbackFadeOutTimer; -}; - -#endif diff --git a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp b/doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp deleted file mode 100644 index 7dd2359..0000000 --- a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tapandholdgesture.h" - -#include <QtGui/qevent.h> - -// #define TAPANDHOLD_USING_MOUSE - -/*! - \class TapAndHoldGesture - \since 4.6 - - \brief The TapAndHoldGesture class represents a Tap-and-Hold gesture, - providing additional information. -*/ - -const int TapAndHoldGesture::iterationCount = 40; -const int TapAndHoldGesture::iterationTimeout = 50; - -/*! - Creates a new Tap and Hold gesture handler object and marks it as a child - of \a parent. - - On some platforms like Windows there is a system-wide tap and hold gesture - that cannot be overriden, hence the gesture might never trigger and default - context menu will be shown instead. -*/ -TapAndHoldGesture::TapAndHoldGesture(QWidget *parent) - : QGesture(parent), iteration(0) -{ -} - -/*! \internal */ -bool TapAndHoldGesture::filterEvent(QEvent *event) -{ - if (!event->spontaneous()) - return false; - const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); - switch (event->type()) { - case QEvent::TouchBegin: { - if (timer.isActive()) - timer.stop(); - timer.start(TapAndHoldGesture::iterationTimeout, this); - const QPoint p = ev->touchPoints().at(0).pos().toPoint(); - position = p; - break; - } - case QEvent::TouchUpdate: - if (ev->touchPoints().size() == 1) { - const QPoint startPos = ev->touchPoints().at(0).startPos().toPoint(); - const QPoint pos = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - pos).manhattanLength() > 15) - reset(); - } else { - reset(); - } - break; - case QEvent::TouchEnd: - reset(); - break; -#ifdef TAPANDHOLD_USING_MOUSE - case QEvent::MouseButtonPress: { - if (timer.isActive()) - timer.stop(); - timer.start(TapAndHoldGesture::iterationTimeout, this); - const QPoint p = static_cast<QMouseEvent*>(event)->pos(); - position = startPosition = p; - break; - } - case QEvent::MouseMove: { - const QPoint startPos = startPosition; - const QPoint pos = static_cast<QMouseEvent*>(event)->pos(); - if ((startPos - pos).manhattanLength() > 15) - reset(); - break; - } - case QEvent::MouseButtonRelease: - reset(); - break; -#endif // TAPANDHOLD_USING_MOUSE - default: - break; - } - return false; -} - -/*! \internal */ -void TapAndHoldGesture::timerEvent(QTimerEvent *event) -{ - if (event->timerId() != timer.timerId()) - return; - if (iteration == TapAndHoldGesture::iterationCount) { - timer.stop(); - updateState(Qt::GestureFinished); - } else { - updateState(Qt::GestureUpdated); - } - ++iteration; -} - -/*! \internal */ -//! [tapandhold-reset] -void TapAndHoldGesture::reset() -{ - timer.stop(); - iteration = 0; - position = startPosition = QPoint(); - updateState(Qt::NoGesture); -} -//! [tapandhold-reset] - -/*! - \property TapAndHoldGesture::pos - - \brief The position of the gesture. -*/ -QPoint TapAndHoldGesture::pos() const -{ - return position; -} diff --git a/doc/src/snippets/gestures/qgesture.cpp b/doc/src/snippets/gestures/qgesture.cpp deleted file mode 100644 index 77f5cc2..0000000 --- a/doc/src/snippets/gestures/qgesture.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgesture.h" -#include <private/qgesture_p.h> -#include "qgraphicsitem.h" - -QT_BEGIN_NAMESPACE - - -class QEventFilterProxyGraphicsItem : public QGraphicsItem -{ -public: - QEventFilterProxyGraphicsItem(QGesture *g) - : gesture(g) - { - } - bool sceneEventFilter(QGraphicsItem *, QEvent *event) - { - return gesture ? gesture->filterEvent(event) : false; - } - QRectF boundingRect() const { return QRectF(); } - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { } - -private: - QGesture *gesture; -}; - -/* - \class QGesture - \since 4.6 - - \brief The QGesture class is the base class for implementing custom - gestures. - - This class represents both an object that recognizes a gesture out of a set - of input events (a gesture recognizer), and a gesture object itself that - can be used to get extended information about the triggered gesture. - - The class has a list of properties that can be queried by the user to get - some gesture-specific parameters (for example, an offset of a Pan gesture). - - Usually gesture recognizer implements a state machine, storing its state - internally in the recognizer object. The recognizer receives input events - through the \l{QGesture::}{filterEvent()} virtual function and decides - whether the event should change the state of the recognizer by emitting an - appropriate signal. - - Input events should be either fed to the recognizer one by one with a - filterEvent() function, or the gesture recognizer should be attached to an - object it filters events for by specifying it as a parent object. The - QGesture object installs itself as an event filter to the parent object - automatically, the unsetObject() function should be used to remove an event - filter from the parent object. To make a - gesture that operates on a QGraphicsItem, both the appropriate QGraphicsView - should be passed as a parent object and setGraphicsItem() functions should - be used to attach a gesture to a graphics item. - - This is a base class, to create a custom gesture type, you should subclass - it and implement its pure virtual functions. - - \sa QPanGesture -*/ - -/* \fn bool QGesture::filterEvent(QEvent *event) - - Parses input \a event and emits a signal when detects a gesture. - - In your reimplementation of this function, if you want to filter the \a - event out, i.e. stop it being handled further, return true; otherwise - return false; - - This is a pure virtual function that needs to be implemented in subclasses. -*/ - -/* \fn void QGesture::started() - - The signal is emitted when the gesture is started. Extended information - about the gesture is contained in the signal sender object. - - In addition to started(), a triggered() signal should also be emitted. -*/ - -/* \fn void QGesture::triggered() - - The signal is emitted when the gesture is detected. Extended information - about the gesture is contained in the signal sender object. -*/ - -/* \fn void QGesture::finished() - - The signal is emitted when the gesture is finished. Extended information - about the gesture is contained in the signal sender object. -*/ - -/* \fn void QGesture::cancelled() - - The signal is emitted when the gesture is cancelled, for example the reset() - function is called while the gesture was in the process of emitting a - triggered() signal. Extended information about the gesture is contained in - the sender object. -*/ - - -/* - Creates a new gesture handler object and marks it as a child of \a parent. - - The \a parent object is also the default event source for the gesture, - meaning that the gesture installs itself as an event filter for the \a - parent. - - \sa setGraphicsItem() -*/ -QGesture::QGesture(QObject *parent) - : QObject(*new QGesturePrivate, parent) -{ - if (parent) - parent->installEventFilter(this); -} - -/* \internal - */ -QGesture::QGesture(QGesturePrivate &dd, QObject *parent) - : QObject(dd, parent) -{ - if (parent) - parent->installEventFilter(this); -} - -/* - Destroys the gesture object. -*/ -QGesture::~QGesture() -{ -} - -/* \internal - */ -bool QGesture::eventFilter(QObject *receiver, QEvent *event) -{ - Q_D(QGesture); - if (d->graphicsItem && receiver == parent()) - return false; - return filterEvent(event); -} - -/* - \property QGesture::state - - \brief The current state of the gesture. -*/ - -/* - Returns the gesture recognition state. - */ -Qt::GestureState QGesture::state() const -{ - return d_func()->state; -} - -/* - Sets this gesture's recognition state to \a state and emits appropriate - signals. - - This functions emits the signals according to the old state and the new - \a state, and it should be called after all the internal properties have been - initialized. - - \sa started(), triggered(), finished(), cancelled() - */ -void QGesture::updateState(Qt::GestureState state) -{ - Q_D(QGesture); - if (d->state == state) { - if (state == Qt::GestureUpdated) - emit triggered(); - return; - } - const Qt::GestureState oldState = d->state; - d->state = state; - if (state != Qt::NoGesture && oldState > state) { - // comparing the state as ints: state should only be changed from - // started to (optionally) updated and to finished. - qWarning("QGesture::updateState: incorrect new state"); - return; - } - if (oldState == Qt::NoGesture) - emit started(); - if (state == Qt::GestureUpdated) - emit triggered(); - else if (state == Qt::GestureFinished) - emit finished(); - else if (state == Qt::NoGesture) - emit cancelled(); - - if (state == Qt::GestureFinished) { - // gesture is finished, so we reset the internal state. - d->state = Qt::NoGesture; - } -} - -/* - Sets the \a graphicsItem the gesture is filtering events for. - - The gesture will install an event filter to the \a graphicsItem and - redirect them to the filterEvent() function. - - \sa graphicsItem() -*/ -void QGesture::setGraphicsItem(QGraphicsItem *graphicsItem) -{ - Q_D(QGesture); - if (d->graphicsItem && d->eventFilterProxyGraphicsItem) - d->graphicsItem->removeSceneEventFilter(d->eventFilterProxyGraphicsItem); - d->graphicsItem = graphicsItem; - if (!d->eventFilterProxyGraphicsItem) - d->eventFilterProxyGraphicsItem = new QEventFilterProxyGraphicsItem(this); - if (graphicsItem) - graphicsItem->installSceneEventFilter(d->eventFilterProxyGraphicsItem); -} - -/* - Returns the graphics item the gesture is filtering events for. - - \sa setGraphicsItem() -*/ -QGraphicsItem* QGesture::graphicsItem() const -{ - return d_func()->graphicsItem; -} - -/* \fn void QGesture::reset() - - Resets the internal state of the gesture. This function might be called by - the filterEvent() implementation in a derived class, or by the user to - cancel a gesture. The base class implementation calls - updateState(Qt::NoGesture) which emits the cancelled() - signal if the state() of the gesture indicated it was active. -*/ -void QGesture::reset() -{ - updateState(Qt::NoGesture); -} - -QT_END_NAMESPACE diff --git a/doc/src/snippets/gestures/qstandardgestures.cpp b/doc/src/snippets/gestures/qstandardgestures.cpp deleted file mode 100644 index b22f6ae..0000000 --- a/doc/src/snippets/gestures/qstandardgestures.cpp +++ /dev/null @@ -1,483 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstandardgestures.h" -#include "qstandardgestures_p.h" - -#include <qabstractscrollarea.h> -#include <qscrollbar.h> -#include <private/qapplication_p.h> -#include <private/qevent_p.h> -#include <private/qwidget_p.h> - -QT_BEGIN_NAMESPACE - -#ifdef Q_WS_WIN -QWidgetPrivate *qt_widget_private(QWidget *widget); -#endif - -/*! - \class QPanGesture - \since 4.6 - - \brief The QPanGesture class represents a Pan gesture, - providing additional information related to panning. -*/ - -/*! - Creates a new Pan gesture handler object and marks it as a child of \a - parent. - - On some platform like Windows it's necessary to provide a non-null widget - as \a parent to get native gesture support. -*/ -QPanGesture::QPanGesture(QWidget *parent) - : QGesture(*new QPanGesturePrivate, parent) -{ - if (parent) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - qAppPriv->widgetGestures[parent].pan = this; -#ifdef Q_WS_WIN - qt_widget_private(parent)->winSetupGestures(); -#endif - } -} - -/*! \internal */ -bool QPanGesture::event(QEvent *event) -{ - switch (event->type()) { - case QEvent::ParentAboutToChange: - if (QWidget *w = qobject_cast<QWidget*>(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pan = 0; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - case QEvent::ParentChange: - if (QWidget *w = qobject_cast<QWidget*>(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pan = this; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - default: - break; - } - -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - Q_D(QPanGesture); - if (event->type() == QEvent::Timer) { - const QTimerEvent *te = static_cast<QTimerEvent *>(event); - if (te->timerId() == d->panFinishedTimer) { - killTimer(d->panFinishedTimer); - d->panFinishedTimer = 0; - d->lastOffset = QSize(0, 0); - updateState(Qt::GestureFinished); - } - } -#endif - - return QObject::event(event); -} - -bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) -{ -#ifdef Q_WS_WIN - Q_D(QPanGesture); - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::iterator it; - it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver)); - if (it == qAppPriv->widgetGestures.end()) - return false; - if (this != it.value().pan) - return false; - Qt::GestureState nextState = Qt::NoGesture; - switch(ev->gestureType) { - case QNativeGestureEvent::GestureBegin: - // next we might receive the first gesture update event, so we - // prepare for it. - d->state = Qt::NoGesture; - return false; - case QNativeGestureEvent::Pan: - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::GestureEnd: - if (state() == Qt::NoGesture) - return false; // some other gesture has ended - nextState = Qt::GestureFinished; - break; - default: - return false; - } - if (state() == Qt::NoGesture) { - d->lastOffset = d->totalOffset = QSize(); - } else { - d->lastOffset = QSize(ev->position.x() - d->lastPosition.x(), - ev->position.y() - d->lastPosition.y()); - d->totalOffset += d->lastOffset; - } - d->lastPosition = ev->position; - updateState(nextState); - return true; - } -#endif - return QGesture::eventFilter(receiver, event); -} - -/*! \internal */ -bool QPanGesture::filterEvent(QEvent *event) -{ - Q_D(QPanGesture); - if (!event->spontaneous()) - return false; - const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); - if (event->type() == QEvent::TouchBegin) { - QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - d->lastPosition = p.pos().toPoint(); - d->lastOffset = d->totalOffset = QSize(); - } else if (event->type() == QEvent::TouchEnd) { - if (state() != Qt::NoGesture) { - if (!ev->touchPoints().isEmpty()) { - QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - const QPoint pos = p.pos().toPoint(); - const QPoint lastPos = p.lastPos().toPoint(); - const QPoint startPos = p.startPos().toPoint(); - d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y()); - d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y()); - } - updateState(Qt::GestureFinished); - } - reset(); - } else if (event->type() == QEvent::TouchUpdate) { - QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - const QPoint pos = p.pos().toPoint(); - const QPoint lastPos = p.lastPos().toPoint(); - const QPoint startPos = p.startPos().toPoint(); - d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y()); - d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y()); - if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 || - d->totalOffset.width() < -10 || d->totalOffset.height() < -10) { - updateState(Qt::GestureUpdated); - } - } -#ifdef Q_OS_MAC - else if (event->type() == QEvent::Wheel) { - // On Mac, there is really no native panning gesture. Instead, a two - // finger pan is delivered as mouse wheel events. Otoh, on Windows, you - // either get mouse wheel events or pan events. We have decided to make this - // the Qt behaviour as well, meaning that on Mac, wheel - // events will be masked away when listening for pan events. -#ifndef QT_MAC_USE_COCOA - // In Carbon we receive neither touch-, nor pan gesture events. - // So we create pan gestures by converting wheel events. After all, this - // is how things are supposed to work on mac in the first place. - const QWheelEvent *wev = static_cast<const QWheelEvent*>(event); - int offset = wev->delta() / -120; - d->lastOffset = wev->orientation() == Qt::Horizontal ? QSize(offset, 0) : QSize(0, offset); - - if (state() == Qt::NoGesture) { - d->totalOffset = d->lastOffset; - } else { - d->totalOffset += d->lastOffset; - } - - killTimer(d->panFinishedTimer); - d->panFinishedTimer = startTimer(200); - updateState(Qt::GestureUpdated); -#endif - return true; - } -#endif - return false; -} - -/*! \internal */ -void QPanGesture::reset() -{ - Q_D(QPanGesture); - d->lastOffset = d->totalOffset = QSize(); - d->lastPosition = QPoint(); -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - if (d->panFinishedTimer) { - killTimer(d->panFinishedTimer); - d->panFinishedTimer = 0; - } -#endif - QGesture::reset(); -} - -/*! - \property QPanGesture::totalOffset - - Specifies a total pan offset since the start of the gesture. -*/ -QSize QPanGesture::totalOffset() const -{ - Q_D(const QPanGesture); - return d->totalOffset; -} - -/*! - \property QPanGesture::lastOffset - - Specifies a pan offset since the last time the gesture was - triggered. -*/ -QSize QPanGesture::lastOffset() const -{ - Q_D(const QPanGesture); - return d->lastOffset; -} - - -/*! - \class QPinchGesture - \since 4.6 - - \brief The QPinchGesture class represents a Pinch gesture, - providing additional information related to zooming and/or rotation. -*/ - -/*! - Creates a new Pinch gesture handler object and marks it as a child of \a - parent. - - On some platform like Windows it's necessary to provide a non-null widget - as \a parent to get native gesture support. -*/ -QPinchGesture::QPinchGesture(QWidget *parent) - : QGesture(*new QPinchGesturePrivate, parent) -{ - if (parent) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - qAppPriv->widgetGestures[parent].pinch = this; -#ifdef Q_WS_WIN - qt_widget_private(parent)->winSetupGestures(); -#endif - } -} - -/*! \internal */ -bool QPinchGesture::event(QEvent *event) -{ - switch (event->type()) { - case QEvent::ParentAboutToChange: - if (QWidget *w = qobject_cast<QWidget*>(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pinch = 0; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - case QEvent::ParentChange: - if (QWidget *w = qobject_cast<QWidget*>(parent())) { - QApplicationPrivate::instance()->widgetGestures[w].pinch = this; -#ifdef Q_WS_WIN - qt_widget_private(w)->winSetupGestures(); -#endif - } - break; - default: - break; - } - return QObject::event(event); -} - -bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) -{ -#ifdef Q_WS_WIN - Q_D(QPinchGesture); - if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { - QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event); - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - QApplicationPrivate::WidgetStandardGesturesMap::iterator it; - it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver)); - if (it == qAppPriv->widgetGestures.end()) - return false; - if (this != it.value().pinch) - return false; - Qt::GestureState nextState = Qt::NoGesture; - switch(ev->gestureType) { - case QNativeGestureEvent::GestureBegin: - // next we might receive the first gesture update event, so we - // prepare for it. - d->state = Qt::NoGesture; - d->scaleFactor = d->lastScaleFactor = 1; - d->rotationAngle = d->lastRotationAngle = 0; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); - d->initialDistance = 0; - return false; - case QNativeGestureEvent::Rotate: - d->lastRotationAngle = d->rotationAngle; - d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument); - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::Zoom: - if (d->initialDistance != 0) { - d->lastScaleFactor = d->scaleFactor; - int distance = int(qint64(ev->argument)); - d->scaleFactor = (qreal) distance / d->initialDistance; - } else { - d->initialDistance = int(qint64(ev->argument)); - } - nextState = Qt::GestureUpdated; - event->accept(); - break; - case QNativeGestureEvent::GestureEnd: - if (state() == Qt::NoGesture) - return false; // some other gesture has ended - nextState = Qt::GestureFinished; - break; - default: - return false; - } - if (d->startCenterPoint.isNull()) - d->startCenterPoint = d->centerPoint; - d->lastCenterPoint = d->centerPoint; - d->centerPoint = static_cast<QWidget*>(receiver)->mapFromGlobal(ev->position); - updateState(nextState); - return true; - } -#endif - return QGesture::eventFilter(receiver, event); -} - -/*! \internal */ -bool QPinchGesture::filterEvent(QEvent *event) -{ - Q_UNUSED(event); - return false; -} - -/*! \internal */ -void QPinchGesture::reset() -{ - Q_D(QPinchGesture); - d->scaleFactor = d->lastScaleFactor = 0; - d->rotationAngle = d->lastRotationAngle = 0; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); - QGesture::reset(); -} - -/*! - \property QPinchGesture::scaleFactor - - Specifies a scale factor of the pinch gesture. -*/ -qreal QPinchGesture::scaleFactor() const -{ - return d_func()->scaleFactor; -} - -/*! - \property QPinchGesture::lastScaleFactor - - Specifies a previous scale factor of the pinch gesture. -*/ -qreal QPinchGesture::lastScaleFactor() const -{ - return d_func()->lastScaleFactor; -} - -/*! - \property QPinchGesture::rotationAngle - - Specifies a rotation angle of the gesture. -*/ -qreal QPinchGesture::rotationAngle() const -{ - return d_func()->rotationAngle; -} - -/*! - \property QPinchGesture::lastRotationAngle - - Specifies a previous rotation angle of the gesture. -*/ -qreal QPinchGesture::lastRotationAngle() const -{ - return d_func()->lastRotationAngle; -} - -/*! - \property QPinchGesture::centerPoint - - Specifies a center point of the gesture. The point can be used as a center - point that the object is rotated around. -*/ -QPoint QPinchGesture::centerPoint() const -{ - return d_func()->centerPoint; -} - -/*! - \property QPinchGesture::lastCenterPoint - - Specifies a previous center point of the gesture. -*/ -QPoint QPinchGesture::lastCenterPoint() const -{ - return d_func()->lastCenterPoint; -} - -/*! - \property QPinchGesture::startCenterPoint - - Specifies an initial center point of the gesture. Difference between the - startCenterPoint and the centerPoint is the distance at which pinching - fingers has shifted. -*/ -QPoint QPinchGesture::startCenterPoint() const -{ - return d_func()->startCenterPoint; -} - -QT_END_NAMESPACE - -#include "moc_qstandardgestures.cpp" - diff --git a/doc/src/snippets/gestures/qstandardgestures.h b/doc/src/snippets/gestures/qstandardgestures.h deleted file mode 100644 index efd6c6e..0000000 --- a/doc/src/snippets/gestures/qstandardgestures.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSTANDARDGESTURES_H -#define QSTANDARDGESTURES_H - -#include <QtGui/qevent.h> -#include <QtCore/qbasictimer.h> - -#include <QtGui/qgesture.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPanGesturePrivate; -class Q_GUI_EXPORT QPanGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPanGesture) - - Q_PROPERTY(QSize totalOffset READ totalOffset) - Q_PROPERTY(QSize lastOffset READ lastOffset) - -public: - QPanGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - - QSize totalOffset() const; - QSize lastOffset() const; - -protected: - void reset(); - -private: - bool event(QEvent *event); - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; -}; - -class QPinchGesturePrivate; -class Q_GUI_EXPORT QPinchGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPinchGesture) - - Q_PROPERTY(qreal scaleFactor READ scaleFactor) - Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor) - - Q_PROPERTY(qreal rotationAngle READ rotationAngle) - Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle) - - Q_PROPERTY(QPoint startCenterPoint READ startCenterPoint) - Q_PROPERTY(QPoint lastCenterPoint READ lastCenterPoint) - Q_PROPERTY(QPoint centerPoint READ centerPoint) - -public: - QPinchGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - void reset(); - - QPoint startCenterPoint() const; - QPoint lastCenterPoint() const; - QPoint centerPoint() const; - - qreal scaleFactor() const; - qreal lastScaleFactor() const; - - qreal rotationAngle() const; - qreal lastRotationAngle() const; - -private: - bool event(QEvent *event); - bool eventFilter(QObject *receiver, QEvent *event); - - friend class QWidget; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSTANDARDGESTURES_H diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro index 09cd56a..e3978b6 100644 --- a/examples/gestures/gestures.pro +++ b/examples/gestures/gestures.pro @@ -1,7 +1,7 @@ TEMPLATE = \ subdirs SUBDIRS = \ - imageviewer + imagegestures # install target.path = $$[QT_INSTALL_EXAMPLES]/gestures diff --git a/examples/gestures/imageviewer/imageviewer.pro b/examples/gestures/imagegestures/imagegestures.pro index 68c1f1c..7780ad9 100644 --- a/examples/gestures/imageviewer/imageviewer.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -1,6 +1,8 @@ -HEADERS += imagewidget.h -SOURCES += imagewidget.cpp \ - main.cpp +HEADERS = imagewidget.h \ + mainwidget.h +SOURCES = imagewidget.cpp \ + main.cpp \ + mainwidget.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index f3fd8e4..95525c5 100644 --- a/examples/gestures/imageviewer/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -43,6 +43,7 @@ #include <QtGui> +//! [constructor] ImageWidget::ImageWidget(QWidget *parent) : QWidget(parent), position(0), @@ -52,24 +53,24 @@ ImageWidget::ImageWidget(QWidget *parent) scaleFactor(1) { - setObjectName("ImageWidget"); setMinimumSize(QSize(100,100)); - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - +//! [enable gestures] grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); grabGesture(Qt::SwipeGesture); +//! [enable gestures] } +//! [constructor] +//! [event handler] bool ImageWidget::event(QEvent *event) { if (event->type() == QEvent::Gesture) return gestureEvent(static_cast<QGestureEvent*>(event)); return QWidget::event(event); } +//! [event handler] void ImageWidget::paintEvent(QPaintEvent*) { @@ -98,6 +99,7 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) update(); } +//! [gesture event handler] bool ImageWidget::gestureEvent(QGestureEvent *event) { if (QGesture *pan = event->gesture(Qt::PanGesture)) { @@ -112,6 +114,7 @@ bool ImageWidget::gestureEvent(QGestureEvent *event) } return false; } +//! [gesture event handler] void ImageWidget::panTriggered(QPanGesture *gesture) { @@ -147,7 +150,7 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture) update(); } -//! [swipe slot] +//! [swipe function] void ImageWidget::swipeTriggered(QSwipeGesture *gesture) { if (gesture->horizontalDirection() == QSwipeGesture::Left @@ -157,7 +160,7 @@ void ImageWidget::swipeTriggered(QSwipeGesture *gesture) goNextImage(); update(); } -//! [swipe slot] +//! [swipe function] void ImageWidget::resizeEvent(QResizeEvent*) { diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h index 7b91fbf..56e2316 100644 --- a/examples/gestures/imageviewer/imagewidget.h +++ b/examples/gestures/imagegestures/imagewidget.h @@ -53,28 +53,28 @@ class QPinchGesture; class QSwipeGesture; QT_END_NAMESPACE +//! [class definition begin] class ImageWidget : public QWidget { Q_OBJECT public: ImageWidget(QWidget *parent = 0); - void openDirectory(const QString &path); protected: - bool event(QEvent*); - bool gestureEvent(QGestureEvent*); - void paintEvent(QPaintEvent*); - void resizeEvent(QResizeEvent*); - void mouseDoubleClickEvent(QMouseEvent*); + bool event(QEvent *event); + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); private: + bool gestureEvent(QGestureEvent *event); void panTriggered(QPanGesture*); void pinchTriggered(QPinchGesture*); void swipeTriggered(QSwipeGesture*); +//! [class definition begin] -private: void updateImage(); QImage loadImage(const QString &fileName); void loadImage(); @@ -93,6 +93,8 @@ private: float verticalOffset; float rotationAngle; float scaleFactor; +//! [class definition end] }; +//! [class definition end] #endif diff --git a/examples/gestures/imageviewer/main.cpp b/examples/gestures/imagegestures/main.cpp index c3d03f3..9c99f31 100644 --- a/examples/gestures/imageviewer/main.cpp +++ b/examples/gestures/imagegestures/main.cpp @@ -41,36 +41,7 @@ #include <QtGui> -#include "imagewidget.h" - -class MainWidget : public QMainWindow -{ - Q_OBJECT - -public: - MainWidget(QWidget *parent = 0); - -public slots: - void openDirectory(const QString &path); - -private: - bool loadImage(const QString &fileName); - - ImageWidget *imageWidget; -}; - -MainWidget::MainWidget(QWidget *parent) - : QMainWindow(parent) -{ - resize(400, 300); - imageWidget = new ImageWidget(this); - setCentralWidget(imageWidget); -} - -void MainWidget::openDirectory(const QString &path) -{ - imageWidget->openDirectory(path); -} +#include "mainwidget.h" int main(int argc, char *argv[]) { @@ -86,5 +57,3 @@ int main(int argc, char *argv[]) return app.exec(); } - -#include "main.moc" diff --git a/doc/src/snippets/gestures/qgesture.h b/examples/gestures/imagegestures/mainwidget.cpp index 3fc89a1..51e9f1e 100644 --- a/doc/src/snippets/gestures/qgesture.h +++ b/examples/gestures/imagegestures/mainwidget.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,63 +39,18 @@ ** ****************************************************************************/ -#ifndef QGESTURE_H -#define QGESTURE_H +#include "imagewidget.h" +#include "mainwidget.h" -#include <QtCore/qobject.h> -#include <QtCore/qlist.h> -#include <QtCore/qdatetime.h> -#include <QtCore/qpoint.h> -#include <QtCore/qrect.h> -#include <QtCore/qmetatype.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QGraphicsItem; -class QGesturePrivate; -class Q_GUI_EXPORT QGesture : public QObject +MainWidget::MainWidget(QWidget *parent) + : QMainWindow(parent) { - Q_OBJECT - Q_DECLARE_PRIVATE(QGesture) - - Q_PROPERTY(Qt::GestureState state READ state) - -public: - explicit QGesture(QObject *parent = 0); - ~QGesture(); - - virtual bool filterEvent(QEvent *event) = 0; - - void setGraphicsItem(QGraphicsItem *); - QGraphicsItem *graphicsItem() const; + resize(400, 300); + imageWidget = new ImageWidget(this); + setCentralWidget(imageWidget); +} - Qt::GestureState state() const; - -protected: - QGesture(QGesturePrivate &dd, QObject *parent); - bool eventFilter(QObject*, QEvent*); - - virtual void reset(); - void updateState(Qt::GestureState state); - -//! [qgesture-signals] -Q_SIGNALS: - void started(); - void triggered(); - void finished(); - void cancelled(); -//! [qgesture-signals] - -private: - friend class QWidget; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGESTURE_H +void MainWidget::openDirectory(const QString &path) +{ + imageWidget->openDirectory(path); +} diff --git a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.h b/examples/gestures/imagegestures/mainwidget.h index 682342e..71b09b0 100644 --- a/doc/src/snippets/gestures/imageviewer/tapandholdgesture.h +++ b/examples/gestures/imagegestures/mainwidget.h @@ -39,36 +39,27 @@ ** ****************************************************************************/ -#ifndef TAPANDHOLDGESTURE_H -#define TAPANDHOLDGESTURE_H +#ifndef MAINWIDGET_H +#define MAINWIDGET_H -#include <QtCore/QBasicTimer> -#include <QtGui/QGesture> -#include <QtGui/QWidget> +#include <QMainWindow> -class TapAndHoldGesture : public QGesture +class ImageWidget; + +class MainWidget : public QMainWindow { Q_OBJECT - Q_PROPERTY(QPoint pos READ pos) public: - TapAndHoldGesture(QWidget *parent); - - bool filterEvent(QEvent *event); - void reset(); + MainWidget(QWidget *parent = 0); - QPoint pos() const; - -protected: - void timerEvent(QTimerEvent *event); +public slots: + void openDirectory(const QString &path); private: - QBasicTimer timer; - int iteration; - QPoint position; - QPoint startPosition; - static const int iterationCount; - static const int iterationTimeout; + bool loadImage(const QString &fileName); + + ImageWidget *imageWidget; }; -#endif // TAPANDHOLDGESTURE_H +#endif diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b990fe2..6f6d706 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5643,7 +5643,7 @@ Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *reco Unregisters all gesture recognizers of the specified \a type. - \sa registerGestureRecognizer + \sa registerGestureRecognizer() */ void QApplication::unregisterGestureRecognizer(Qt::GestureType type) { diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 4826704..2ff6d65 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3563,6 +3563,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) \brief The QTouchEvent class contains parameters that describe a touch event. \since 4.6 \ingroup events + \ingroup multitouch \section1 Enabling Touch Events @@ -4195,6 +4196,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T \class QGestureEvent \since 4.6 \ingroup events + \ingroup gestures \brief The QGestureEvent class provides the description of triggered gestures. @@ -4316,4 +4318,44 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const return gesture ? gesture->d_func()->accept : false; } +#ifdef Q_NO_USING_KEYWORD +/*! + \fn void QGestureEvent::setAccepted(bool accepted) + + Sets or clears the event's internal flag that determines whether it should + be delivered to other objects. + + Calling this function with a value of true for \a accepted indicates that the + caller has accepted the event and that it should not be propagated further. + Calling this function with a value of false indicates that the caller has + ignored the event and that it should be delivered to other objects. + + For convenience, the accept flag can also be set with accept(), and cleared + with ignore(). + + \sa QEvent::accepted +*/ +/*! + \fn bool QGestureEvent::isAccepted() const + + Returns true is the event has been accepted; otherwise returns false. + + \sa QEvent::accepted +*/ +/*! + \fn void QGestureEvent::accept() + + Accepts the event, the equivalent of calling setAccepted(true). + + \sa QEvent::accept() +*/ +/*! + \fn void QGestureEvent::ignore() + + Ignores the event, the equivalent of calling setAccepted(false). + + \sa QEvent::ignore() +*/ +#endif + QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 3639a45..fc8df49 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -47,15 +47,19 @@ QT_BEGIN_NAMESPACE /*! \class QGesture \since 4.6 + \ingroup gestures \brief The QGesture class represents a gesture, containing properties that describe the corresponding user input. - QGesture objects are delivered to widgets and \l{QGraphicsObject}s with - \l{QGestureEvent}s. + Gesture objects are not constructed directly by developers. They are created by + the QGestureRecognizer object that is registered with the application; see + QApplication::registerGestureRecognizer(). + + \section1 Gesture Properties The class has a list of properties that can be queried by the user to get - some gesture-specific arguments. For example, the QPinchGesture gesture has a scale + some gesture-specific arguments. For example, the pinch gesture has a scale factor that is exposed as a property. Developers of custom gesture recognizers can add additional properties in @@ -63,6 +67,23 @@ QT_BEGIN_NAMESPACE by adding new dynamic properties to a QGesture object, or by subclassing the QGesture class (or one of its subclasses). + \section1 Lifecycle of a Gesture Object + + A QGesture instance is created when the application calls QWidget::grabGesture() + or QGraphicsObject::grabGesture() to configure a widget or graphics object (the + target object) for gesture input. One gesture object is created for each target + object. + + The registered gesture recognizer monitors the input events for the target + object via its \l{QGestureRecognizer::}{filterEvent()} function, updating the + properties of the gesture object as required. + + The gesture object may be delivered to the target object in a QGestureEvent if + the corresponding gesture is active or has just been canceled. Each event that + is delivered contains a list of gesture objects, since support for more than + one gesture may be enabled for the target object. Due to the way events are + handled in Qt, gesture events may be filtered by other objects. + \sa QGestureEvent, QGestureRecognizer */ @@ -165,8 +186,55 @@ void QGesture::unsetHotSpot() d_func()->isHotSpotSet = false; } -// QPanGesture +/*! + \class QPanGesture + \since 4.6 + \brief The QPanGesture class describes a panning gesture made by the user. + \ingroup gestures + + \image pangesture.png + \sa {Gestures Programming}, QPinchGesture, QSwipeGesture +*/ + +/*! + \property QPanGesture::totalOffset + \brief the total offset from the first input position to the current input + position + + The total offset measures the total change in position of the user's input + covered by the gesture on the input device. +*/ + +/*! + \property QPanGesture::lastOffset + \brief the last offset recorded for this gesture + + The last offset contains the change in position of the user's input as + reported in the \l offset property when a previous gesture event was + delivered for this gesture. + + If no previous event was delivered with information about this gesture + (i.e., this gesture object contains information about the first movement + in the gesture) then this property contains a zero size. +*/ + +/*! + \property QPanGesture::offset + \brief the offset from the previous input position to the current input + position + + The offset measures the change in position of the user's input on the + input device. +*/ + +/*! + \property QPanGesture::acceleration +*/ + +/*! + \internal +*/ QPanGesture::QPanGesture(QObject *parent) : QGesture(*new QPanGesturePrivate, parent) { @@ -214,8 +282,139 @@ void QPanGesture::setAcceleration(qreal value) d_func()->acceleration = value; } -// QPinchGesture +/*! + \class QPinchGesture + \since 4.6 + \brief The QPinchGesture class describes a pinch gesture made my the user. + \ingroup multitouch + \ingroup gestures + + A pinch gesture is a form of multitouch user input in which the user typically + touches two points on the input device with a thumb and finger, before moving + them closer together or further apart to change the scale factor, zoom, or level + of detail of the user interface. + + \image pinchgesture.png + + Instead of repeatedly applying the same pinching gesture, the user may + continue to touch the input device in one place, and apply a second touch + to a new point, continuing the gesture. When this occurs, gesture events + will continue to be delivered to the target object, containing an instance + of QPinchGesture in the Qt::GestureUpdated state. + + \sa {Gestures Programming}, QPanGesture, QSwipeGesture +*/ + +/*! + \enum QPinchGesture::WhatChange + + This enum describes the changes that can occur to the properties of + the gesture object. + + \value ScaleFactorChanged The scale factor held by scaleFactor changed. + \value RotationAngleChanged The rotation angle held by rotationAngle changed. + \value CenterPointChanged The center point held by centerPoint changed. + + \sa whatChanged +*/ + +/*! + \property QPinchGesture::whatChanged + \brief the property of the gesture that has changed + + This property indicates which of the other properties has changed since + the previous gesture event included information about this gesture. You + can use this information to determine which aspect of your user interface + needs to be updated. + + \sa scaleFactor, rotationAngle, centerPoint +*/ + +/*! + \property QPinchGesture::totalScaleFactor + \brief the total scale factor + + The total scale factor measures the total change in scale factor from the + original value to the current scale factor. + + \sa scaleFactor, lastScaleFactor +*/ +/*! + \property QPinchGesture::lastScaleFactor + \brief the last scale factor recorded for this gesture + + The last scale factor contains the scale factor reported in the + \l scaleFactor property when a previous gesture event included + information about this gesture. + + If no previous event was delivered with information about this gesture + (i.e., this gesture object contains information about the first movement + in the gesture) then this property contains zero. + + \sa scaleFactor, totalScaleFactor +*/ +/*! + \property QPinchGesture::scaleFactor + \brief the current scale factor + + The scale factor measures the scale factor associated with the distance + between two of the user's inputs on a multitouch device. + + \sa totalScaleFactor, lastScaleFactor +*/ + +/*! + \property QPinchGesture::totalRotationAngle + \brief the total angle covered by the gesture + + This total angle measures the complete angle covered by the gesture. Usually, this + is equal to the value held by the \l rotationAngle property, except in the case where + the user performs multiple rotations by removing and repositioning one of the touch + points, as described above. In this case, the total angle will be the sum of the + rotation angles for the multiple stages of the gesture. + + \sa rotationAngle, lastRotationAngle +*/ +/*! + \property QPinchGesture::lastRotationAngle + \brief the last reported angle covered by the gesture motion + + The last rotation angle is the angle as reported in the \l rotationAngle property + when a previous gesture event was delivered for this gesture. + + \sa rotationAngle, totalRotationAngle +*/ +/*! + \property QPinchGesture::rotationAngle + \brief the angle covered by the gesture motion + + \sa totalRotationAngle, lastRotationAngle +*/ +/*! + \property QPinchGesture::startCenterPoint + \brief the starting position of the center point + + \sa centerPoint, lastCenterPoint +*/ +/*! + \property QPinchGesture::lastCenterPoint + \brief the last position of the center point recorded for this gesture + + \sa centerPoint, startCenterPoint +*/ +/*! + \property QPinchGesture::centerPoint + \brief the current center point + + The center point is the midpoint between the two input points in the gesture. + + \sa startCenterPoint, lastCenterPoint +*/ + +/*! + \internal +*/ QPinchGesture::QPinchGesture(QObject *parent) : QGesture(*new QPinchGesturePrivate, parent) { @@ -325,8 +524,65 @@ void QPinchGesture::setRotationAngle(qreal value) d_func()->rotationAngle = value; } -// QSwipeGesture +/*! + \class QSwipeGesture + \since 4.6 + \brief The QSwipeGesture class describes a swipe gesture made by the user. + \ingroup gestures + + \image swipegesture.png + + \sa {Gestures Programming}, QPanGesture, QPinchGesture +*/ + +/*! + \enum QSwipeGesture::SwipeDirection + + This enum describes the possible directions for the gesture's motion + along the horizontal and vertical axes. + + \value NoDirection The gesture had no motion associated with it on a particular axis. + \value Left The gesture involved a horizontal motion to the left. + \value Right The gesture involved a horizontal motion to the right. + \value Up The gesture involved an upward vertical motion. + \value Down The gesture involved a downward vertical motion. +*/ + +/*! + \property QSwipeGesture::horizontalDirection + \brief the horizontal direction of the gesture + + If the gesture has a horizontal component, the horizontal direction + is either Left or Right; otherwise, it is NoDirection. + + \sa verticalDirection, swipeAngle +*/ + +/*! + \property QSwipeGesture::verticalDirection + \brief the vertical direction of the gesture + + If the gesture has a vertical component, the vertical direction + is either Up or Down; otherwise, it is NoDirection. + + \sa horizontalDirection, swipeAngle +*/ + +/*! + \property QSwipeGesture::swipeAngle + \brief the angle of the motion associated with the gesture + + If the gesture has either a horizontal or vertical component, the + swipe angle describes the angle between the direction of motion and the + x-axis as defined using the standard widget + \l{The Coordinate System}{coordinate system}. + + \sa horizontalDirection, verticalDirection +*/ +/*! + \internal +*/ QSwipeGesture::QSwipeGesture(QObject *parent) : QGesture(*new QSwipeGesturePrivate, parent) { diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 2af087f..9de3bcc 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE \class QGestureRecognizer \since 4.6 \brief The QGestureRecognizer class provides the infrastructure for gesture recognition. + \ingroup gestures Gesture recognizers are responsible for creating and managing QGesture objects and monitoring input events sent to QWidget and QGraphicsObject subclasses. @@ -65,9 +66,11 @@ QT_BEGIN_NAMESPACE about the user's input. Gestures are created when the framework calls createGesture() to handle user input - for a particular target QWidget or QGraphicsObject instance. Once a QGesture has been - created for one of these objects, the gesture recognizer will receive events for it - in its filterEvent() handler function. + for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object + is created for each widget or item that is configured to use gestures. + + Once a QGesture has been created for a target object, the gesture recognizer will + receive events for it in its filterEvent() handler function. When a gesture is canceled, the reset() function is called, giving the recognizer the chance to update the appropriate properties in the corresponding QGesture object. @@ -75,15 +78,18 @@ QT_BEGIN_NAMESPACE \section1 Supporting New Gestures To add support for new gestures, you need to derive from QGestureRecognizer to create - a custom recognizer class and register it with the application by calling - QApplication::registerGestureRecognizer(). You can also derive from QGesture to create - a custom gesture class, or rely on dynamic properties to express specific details - of the gesture you want to handle. + a custom recognizer class, construct an instance of this class, and register it with + the application by calling QApplication::registerGestureRecognizer(). You can also + subclass QGesture to create a custom gesture class, or rely on dynamic properties + to express specific details of the gesture you want to handle. Your custom QGestureRecognizer subclass needs to reimplement the filterEvent() function to handle and filter the incoming input events for QWidget and QGraphicsObject subclasses. - Although the logic for gesture recognition is implemented in this function, the state of - recognition for each target object can be recorded in the QGesture object supplied. + Although the logic for gesture recognition is implemented in this function, you can + store persistent information about the state of the recognition process in the QGesture + object supplied. The filterEvent() function must return a value of Qt::GestureState that + indicates the state of recognition for a given gesture and target object. This determines + whether or not a gesture event will be delivered to a target object. If you choose to represent a gesture by a custom QGesture subclass, you will need to reimplement the createGesture() function to construct instances of your gesture class. |