<html><head></head><body><div id="fenix-user-content">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'">Hi Jonni,</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;font-family:'NokiaPureTextLight'"><br></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'">Does that mean that I cannot dynamically enable/disable swipe lock on the fly?</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;font-family:'NokiaPureTextLight'"><br></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'">Thanks for your answer!</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;font-family:'NokiaPureTextLight'"><br></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'">Regards... </span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'"> </span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'">--</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'"> </span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'">...Mariano Boragno...</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'NokiaPureTextLight'"> </span></p></div><br><div id="fenix-reply-header"><p>On 29/11/13 14:45 Jonni Rainisto wrote:<br>
</p></div><div id="fenix-quoted-body"><div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi<br>
<br>
You need to call that before your setSource-line, as setFlags will not do anything if qml is already loaded.<br>
<br>
Usually I do it with something like this:<br>
<span style="color:#c0c0c0"></span><span style="color:#800080"> QScopedPointer</span><span style><</span><span style="color:#800080">QGuiApplication</span><span style>></span><span style="color:#c0c0c0">
</span><span style>app</span><span style>(</span><span style="color:#800080">Sailfish</span><span style>::</span><span style>createApplication</span><span style>(</span><span style>argc</span><span style>,</span><span style="color:#c0c0c0">
</span><span style>argv</span><span style>));</span><br>
<span style="color:#c0c0c0"></span><span style="color:#800080"> QScopedPointer</span><span style><</span><span style="color:#800080">QQuickView</span><span style>></span><span style="color:#c0c0c0">
</span><span style>view</span><span style>(</span><span style="color:#800080">Sailfish</span><span style>::</span><span style>createView</span><span style>());</span><br>
<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#c0c0c0"> </span><span style="color:#008000">//</span><span style="color:#c0c0c0"> </span><span style="color:#008000">Disable</span><span style="color:#c0c0c0"> </span><span style="color:#008000">swipe</span><span style="color:#c0c0c0"> </span><span style="color:#008000">gestures</span><span style="color:#c0c0c0"> </span><span style="color:#008000">in</span><span style="color:#c0c0c0"> </span><span style="color:#008000">proper</span><span style="color:#c0c0c0"> </span><span style="color:#008000">way</span></pre>
<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#c0c0c0"> </span><span style>view</span><span style>-></span><span style>setFlags</span><span style>(</span><span style>view</span><span style>-></span><span style>flags</span><span style>()|</span><span style="color:#800080">Qt</span><span style>::</span><span style="color:#800080">WindowOverridesSystemGestures</span><span style>);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">Sailfish</span><span style>::</span><span style>setView</span><span style>(</span><span style>view</span><span style>.</span><span style>data</span><span style>(),</span><span style="color:#c0c0c0"> </span><span style="color:#008000">"qrc:/main.qml"</span><span style>);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><br></pre>
re, Jonni<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:devel-bounces@lists.sailfishos.org" target="_blank">devel-bounces@lists.sailfishos.org</a> [<a href="mailto:devel-bounces@lists.sailfishos.org" target="_blank">devel-bounces@lists.sailfishos.org</a>] on behalf of Mariano Boragno [<a href="mailto:marianoboragno@gmail.com" target="_blank">marianoboragno@gmail.com</a>]<br>
<b>Sent:</b> Friday, November 29, 2013 6:54 PM<br>
<b>To:</b> <a href="mailto:devel@lists.sailfishos.org" target="_blank">devel@lists.sailfishos.org</a><br>
<b>Subject:</b> [SailfishDevel] Swipe Lock<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>
<div>Hi guys,<br>
<br>
</div>
I'm doing a game that requires to lock the system gestures (it's a game for babies, so I have to lock the swipe to avoid the baby from surfing all around the phone :) )<br>
<br>
</div>
According to <a href="https://sailfishos.org/wiki/Porting/Harmattan" target="_blank">
https://sailfishos.org/wiki/Porting/Harmattan</a> it must be done through Qt::WindowOverridesSystemGestures, which I guess must be set on the main window. What I've done is:<br>
<br>
QGuiApplication *app = SailfishApp::application(argc, argv);<br>
QQuickView *view = SailfishApp::createView();<br>
<div>
<div> view->setSource(SailfishApp::pathTo("qml/myGame.qml"));<br>
view->showFullScreen();<br>
<br>
view->setFlags(view->flags() | Qt::WindowOverridesSystemGestures);<br>
<br>
return app->exec();<br>
<br>
</div>
<div>But I can still swipe the app away in the emulator.<br>
<br>
<div>What am I doing wrong?<br>
<br>
Thanks a lot, regards...<br>
<br>
</div>
<div><br clear="all">
<div>
<div>...Mariano Boragno...</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br></div><br></body></html>