[Android-development] orientationChanged() not propagated on Android.

Wiktor Grębla greblus at gmail.com
Fri Jun 24 13:56:32 CEST 2016


It works. I forgot to add slot to the header file and it wasn't connected :>
What a shame...

Sorry for the trouble.
W.

2016-06-24 13:18 GMT+02:00 ekke <ekke at ekkes-corner.org>:

> Am 24.06.16 um 13:03 schrieb Wiktor Grębla:
>
> Thanks for your reply Ekke.
>
> I've tried  <https://wiki.qt.io/QML_orientation_observer>
> https://wiki.qt.io/QML_orientation_observer and it works in QtQuick.
>
> for qml I'm doing it this simple way:
>
> ApplicationWindow {
>
>     id: appWindow
>
>     // ...
>
>     property bool isLandscape: width > height
>
>
> and from C++ orientationChanged() SIGNAL also works
>
> No luck so far in QtWidgets.
>
> never done anything with Widgets
>
> ekke
>
>
> W.
>
> 2016-06-24 12:31 GMT+02:00 ekke <ekke at ekkes-corner.org>:
>
>> just did a short test (Qt 5.7, QuickControls2 APP)
>>
>> tested Android 6.0.1 on BlackBerry PRIV:
>> orientation change works between Portrait and Landscape
>> but from Landscape to InvertedLandscape or from InvertedLandscape to
>> Landscape there was no signal
>> for me no problem - don't have to distinguish
>> InvertedPortrait couldn't be tested because my device doesn't allow this
>>
>> tested on iOS 9.3 (iPhone 6s)
>> all signals are coming in
>>
>> ciao
>>
>> ekke
>>
>> Am 24.06.16 um 11:40 schrieb Wiktor Grębla:
>>
>> Hi guys.
>>
>> I've been trying to use orientationChanged signal to react on orientation
>> changes but somehow can't get it to work.
>>
>> 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.
>>
>> I've tried it on Qt-5.6 and now on Qt-5.7:
>>
>> #include "mainwindow.h"
>>
>> #include "ui_mainwindow.h"
>>
>> #include <QScreen>
>>
>> MainWindow::MainWindow(QWidget *parent) :
>>
>>     QMainWindow(parent),
>>
>>     ui(new Ui::MainWindow)
>>
>> {
>>
>>     ui->setupUi(this);
>>
>>     QScreen * screen = QGuiApplication::primaryScreen();
>>
>>     connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), this, SLOT(onRotate(Qt::ScreenOrientation)));
>>
>>     screen->setOrientationUpdateMask(Qt::PortraitOrientation| Qt::LandscapeOrientation| Qt::InvertedPortraitOrientation| Qt::InvertedLandscapeOrientation);
>>
>> }
>>
>> void MainWindow::onRotate(Qt::ScreenOrientation)
>>
>> {
>>
>>     ui->label->setText("Rotated!");
>>
>> }
>>
>> MainWindow::~MainWindow()
>>
>> {
>>
>>     delete ui;
>>
>> }
>>
>> I'll be grateful for any hints or suggestions.
>>
>> Cheers,
>>
>> W.
>>
>>
>> --
>> Talkers are no good doers.
>>
>>
>> _______________________________________________
>> Android-development mailing listAndroid-development at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/android-development
>>
>>
>>
>
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development
>
>


-- 
Talkers are no good doers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20160624/58290ade/attachment.html>


More information about the Android-development mailing list