[Android-development] orientationChanged() not propagated on Android.
ekke
ekke at ekkes-corner.org
Fri Jun 24 13:18:12 CEST 2016
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 and it works in
> QtQuick.
for qml I'm doing it this simple way:
ApplicationWindow{
id:appWindow
// ...
propertyboolisLandscape: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
> <mailto: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(newUi::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);
>> }
>> voidMainWindow::onRotate(Qt::ScreenOrientation)
>> {
>> ui->label->setText("Rotated!");
>> }
>> MainWindow::~MainWindow()
>> {
>> deleteui;
>> }
>> I'll be grateful for any hints or suggestions.
>> Cheers,
>> W.
>>
>> --
>> Talkers are no good doers.
>>
>>
>> _______________________________________________
>> Android-development mailing list
>> Android-development at qt-project.org
>> <mailto:Android-development at qt-project.org>
>> http://lists.qt-project.org/mailman/listinfo/android-development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20160624/ba0e6068/attachment.html>
More information about the Android-development
mailing list