<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 24.06.16 um 13:03 schrieb Wiktor
      Grębla:<br>
    </div>
    <blockquote
cite="mid:CAFDUY8KyPD0-iQrhe=uh6iBEJG-DBDeze4k3-o8uSYfhnHiW=Q@mail.gmail.com"
      type="cite">
      <div dir="ltr"><span style="font-size:12.8px">Thanks for your
          reply Ekke.</span>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">I've tried <a
            moz-do-not-send="true"
            href="https://wiki.qt.io/QML_orientation_observer"
            target="_blank"><a class="moz-txt-link-freetext" href="https://wiki.qt.io/QML_orientation_observer">https://wiki.qt.io/QML_orientation_observer</a></a> and
          it works in QtQuick. <br>
        </div>
      </div>
    </blockquote>
    for qml I'm doing it this simple way:<br>
    <br>
    <meta name="qrichtext" content="1">
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment--><span style=" color:#800080;">ApplicationWindow</span><span style=" color:#c0c0c0;"> </span>{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">id</span>:<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#000000;">appWindow</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#008000;">// ... </span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">property</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">isLandscape</span>:<span style=" color:#c0c0c0;"> </span>width<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span>height<!--EndFragment--></pre>
    <style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
    and from C++ orientationChanged() SIGNAL also works<br>
    <blockquote
cite="mid:CAFDUY8KyPD0-iQrhe=uh6iBEJG-DBDeze4k3-o8uSYfhnHiW=Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="font-size:12.8px">No luck so far in QtWidgets.</div>
      </div>
    </blockquote>
    never done anything with Widgets<br>
    <br>
    ekke<br>
    <blockquote
cite="mid:CAFDUY8KyPD0-iQrhe=uh6iBEJG-DBDeze4k3-o8uSYfhnHiW=Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">W.</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2016-06-24 12:31 GMT+02:00 ekke <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:ekke@ekkes-corner.org" target="_blank">ekke@ekkes-corner.org</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>just did a short test (Qt 5.7, QuickControls2 APP)<br>
                <br>
                tested Android 6.0.1 on BlackBerry PRIV:<br>
                orientation change works between Portrait and Landscape<br>
                but from Landscape to InvertedLandscape or from
                InvertedLandscape to Landscape there was no signal<br>
                for me no problem - don't have to distinguish<br>
                InvertedPortrait couldn't be tested because my device
                doesn't allow this<br>
                <br>
                tested on iOS 9.3 (iPhone 6s)<br>
                all signals are coming in<br>
                <br>
                ciao<br>
                <br>
                ekke<br>
                <br>
                Am 24.06.16 um 11:40 schrieb Wiktor Grębla:<br>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div dir="ltr">Hi guys.
                      <div><br>
                      </div>
                      <div>I've been trying to use orientationChanged
                        signal to react on orientation changes but
                        somehow can't get it to work. </div>
                      <div><br>
                      </div>
                      <div>I've seen some old threads with similar
                        reports (Qt-5.3) but I'm more keen to believe
                        that I'm doing something wrong rather than it's
                        not working.</div>
                      <div><br>
                      </div>
                      <div>I've tried it on Qt-5.6 and now on Qt-5.7:</div>
                      <div><br>
                      </div>
                      <div>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"mainwindow.h"</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"ui_mainwindow.h"</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><QScreen></span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">MainWindow</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">QWidget</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">parent</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QMainWindow</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">parent</span><span style="color:rgb(0,0,0)">),</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,0)">ui</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Ui</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">)</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,0)">ui</span><span style="color:rgb(0,0,0)">-></span>setupUi<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">);</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QScreen</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">screen</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span>QGuiApplication<span style="color:rgb(0,0,0)">::</span>primaryScreen<span style="color:rgb(0,0,0)">();</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">connect</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">screen</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">SIGNAL</span><span style="color:rgb(0,0,0)">(</span>orientationChanged<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ScreenOrientation</span><span style="color:rgb(0,0,0)">)),</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">SLOT</span><span style="color:rgb(0,0,0)">(</span>onRotate<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ScreenOrientation</span><span style="color:rgb(0,0,0)">)));</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">screen</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setOrientationUpdateMask</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">PortraitOrientation</span><span style="color:rgb(0,0,0)">|</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">LandscapeOrientation</span><span style="color:rgb(0,0,0)">|</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">InvertedPortraitOrientation</span><span style="color:rgb(0,0,0)">|</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">InvertedLandscapeOrientation</span><span style="color:rgb(0,0,0)">);</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">onRotate</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ScreenOrientation</span><span style="color:rgb(0,0,0)">)</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,0)">ui</span><span style="color:rgb(0,0,0)">-></span>label<span style="color:rgb(0,0,0)">-></span>setText<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Rotated!"</span><span style="color:rgb(0,0,0)">);</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">::~</span><span style="font-style:italic;color:rgb(0,0,0)">MainWindow</span><span style="color:rgb(0,0,0)">()</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">delete</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">ui</span><span style="color:rgb(0,0,0)">;</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
                        <pre style="margin-top:0px;margin-bottom:0px">I'll be grateful for any hints or suggestions.</pre>
                        <pre style="margin-top:0px;margin-bottom:0px">Cheers,</pre>
                        <pre style="margin-top:0px;margin-bottom:0px">W.</pre>
                        <div><br>
                        </div>
                        -- <br>
                        <div data-smartmail="gmail_signature">Talkers
                          are no good doers.<br>
                        </div>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </div>
                <pre>_______________________________________________
Android-development mailing list
<a moz-do-not-send="true" href="mailto:Android-development@qt-project.org" target="_blank">Android-development@qt-project.org</a>
<a moz-do-not-send="true" href="http://lists.qt-project.org/mailman/listinfo/android-development" target="_blank">http://lists.qt-project.org/mailman/listinfo/android-development</a>
</pre>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>