Qt Autorotation

Qt Autorotation

Felipe Crochik

2010-05-26 15:21 UTC
Now that PR1.2 is out autorotation works!!! Great but.
Has anybody figured out how to control the autorotation on the application
(without the "Ctrl+shift+r")?

The WA_Maemo5AutoOrientation only tells "the device" that you want this
application to autorotate but the user still needs to press the "shortcut"
(I have the worst time with my fat fingers) to activate/deactivate it. And
worst of all you need to do the same every time you start the application.
At least I would like to allow the user to save as a setting for later...

Thanks,
Felipe

  •  Reply

Re: Qt Autorotation

Luca Donaggio
Karma: 308
2010-05-26 15:50 UTC
On Wed, May 26, 2010 at 5:21 PM, Felipe Crochik <felipe@crochik.com> wrote:

> Now that PR1.2 is out autorotation works!!! Great but.
> Has anybody figured out how to control the autorotation on the application
> (without the "Ctrl+shift+r")?
>
> The WA_Maemo5AutoOrientation only tells "the device" that you want this
> application to autorotate but the user still needs to press the "shortcut"
> (I have the worst time with my fat fingers) to activate/deactivate it. And
> worst of all you need to do the same every time you start the application.
> At least I would like to allow the user to save as a setting for later...
>
> Thanks,
> Felipe
>
>

I'm not sure I'm following you... I just tried with an app I'm working on
(based on python + PySide) and the only thing needed to enable autoratation
is setting the WA_Maemo5AutoOrientation flag for *every* window.
The only issue I'm having is that if you open a new stacked window while in
portrait, it nevertheless starts in landscape, but turning the device around
a bit triggers auto rotation again.

--
Luca Donaggio

  •  Reply

Re: Qt Autorotation

Daniil Ivanov
Karma: 31
2010-05-26 15:52 UTC
Hi Felipe!

Two things. Autorotation was around since N900 sales release.
And this test app works for me fine in PR 1.2 without pressing anything.

#include <QApplication>
#include <QMainWindow>

int
main (int argc,
char **argv)
{
QApplication app(argc, argv);
QMainWindow win;
win.setAttribute(Qt::WA_Maemo5AutoOrientation, true);
win.show();

return app.exec();
}

~Daniil.

On Wed, May 26, 2010 at 6:21 PM, Felipe Crochik <felipe@crochik.com> wrote:
> Now that PR1.2 is out autorotation works!!! Great but.
> Has anybody figured out how to control the autorotation on the application
> (without the "Ctrl+shift+r")?
>
> The WA_Maemo5AutoOrientation only tells "the device" that you want this
> application to autorotate but the user still needs to press the "shortcut"
> (I have the worst time with my fat fingers) to activate/deactivate it. And
> worst of all you need to do the same every time you start the application.
> At least I would like to allow the user to save as a setting for later...
>
> Thanks,
> Felipe
>
>
  •  Reply

Re: Qt Autorotation

Attila Csipa
Karma: 1430
2010-05-26 15:57 UTC
On Wednesday 26 May 2010 17:21:42 Felipe Crochik wrote:
> The WA_Maemo5AutoOrientation only tells "the device" that you want this
> application to autorotate but the user still needs to press the "shortcut"
> (I have the worst time with my fat fingers) to activate/deactivate it. And

IIUC the two are unrelated. CTRL-SHIFT-R is forced autorotation provided by
the system, WA_Maemo5AutoOrientation is a Qt option enabling the application
to deal with it itself. There might be some 'remembering' involved though as
some applications seem to remember it (like mail and conversations - might be
caused by the fact that they never really quit, though).

Regards,
Attila
  •  Reply

RE: Qt Autorotation

Felipe Crochik

2010-05-26 16:27 UTC
I combined the reply to all post:

My application seems to start "autorotating" after I click on the
application title to show the menu for the first time. I don't have to
select anything and I don't do anything different on my code about the
implementation of the menu.

Very odd... I will have to try some different things to see if I can isolate
the problem further.

@Daniil: The test project works fine on my n900
@Luca: I don't think you need to set on all windows, just the top most seems
to be enough.
@Attila: I did not know that.

Thank you
Felipe

-----Original Message-----
From: Daniil Ivanov [mailto:daniil.ivanov@gmail.com]
Sent: Wednesday, May 26, 2010 11:53 AM
To: Felipe Crochik
Cc: maemo-developers@maemo.org
Subject: Re: Qt Autorotation

Hi Felipe!

Two things. Autorotation was around since N900 sales release.
And this test app works for me fine in PR 1.2 without pressing anything.

#include <QApplication>
#include <QMainWindow>

int
main (int argc,
char **argv)
{
QApplication app(argc, argv);
QMainWindow win;
win.setAttribute(Qt::WA_Maemo5AutoOrientation, true);
win.show();

return app.exec();
}

~Daniil.

On Wed, May 26, 2010 at 6:21 PM, Felipe Crochik <felipe@crochik.com> wrote:
> Now that PR1.2 is out autorotation works!!! Great but.
> Has anybody figured out how to control the autorotation on the application
> (without the "Ctrl+shift+r")?
>
> The WA_Maemo5AutoOrientation only tells "the device" that you want this
> application to autorotate but the user still needs to press the "shortcut"
> (I have the worst time with my fat fingers) to activate/deactivate it. And
> worst of all you need to do the same every time you start the application.
> At least I would like to allow the user to save as a setting for later...
>
> Thanks,
> Felipe
>
>

  •  Reply

Re: Qt Autorotation

Luca Donaggio
Karma: 308
2010-05-27 08:40 UTC
On Wed, May 26, 2010 at 6:27 PM, Felipe Crochik <felipe@crochik.com> wrote:

> I combined the reply to all post:
>
> My application seems to start "autorotating" after I click on the
> application title to show the menu for the first time. I don't have to
> select anything and I don't do anything different on my code about the
> implementation of the menu.
>
> Very odd... I will have to try some different things to see if I can
> isolate
> the problem further.
>
> @Daniil: The test project works fine on my n900
> @Luca: I don't think you need to set on all windows, just the top most
> seems
> to be enough.
> @Attila: I did not know that.
>
> Thank you
> Felipe
>
> -----Original Message-----
> From: Daniil Ivanov [mailto:daniil.ivanov@gmail.com]
> Sent: Wednesday, May 26, 2010 11:53 AM
> To: Felipe Crochik
> Cc: maemo-developers@maemo.org
> Subject: Re: Qt Autorotation
>
> Hi Felipe!
>
> Two things. Autorotation was around since N900 sales release.
> And this test app works for me fine in PR 1.2 without pressing anything.
>
> #include <QApplication>
> #include <QMainWindow>
>
> int
> main (int argc,
> char **argv)
> {
> QApplication app(argc, argv);
> QMainWindow win;
> win.setAttribute(Qt::WA_Maemo5AutoOrientation, true);
> win.show();
>
> return app.exec();
> }
>
> ~Daniil.
>
> On Wed, May 26, 2010 at 6:21 PM, Felipe Crochik <felipe@crochik.com>
> wrote:
> > Now that PR1.2 is out autorotation works!!! Great but.
> > Has anybody figured out how to control the autorotation on the
> application
> > (without the "Ctrl+shift+r")?
> >
> > The WA_Maemo5AutoOrientation only tells "the device" that you want this
> > application to autorotate but the user still needs to press the
> "shortcut"
> > (I have the worst time with my fat fingers) to activate/deactivate it.
> And
> > worst of all you need to do the same every time you start the
> application.
> > At least I would like to allow the user to save as a setting for later...
> >
> > Thanks,
> > Felipe
> >
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers@maemo.org
> > https://lists.maemo.org/mailman/listinfo/maemo-developers
> >
>
>
Felipe, you're absolutely right: once set the autorotation flag in the
topmost window of the stack, the others seem to retain it.
Only issue remaining is that once you open a new stacked window, it starts
in landscape mode, disregarding current device orientation, *but* its child
widgets are layed out respecting the correct screen proportions.
I can check for screen geometry and set the landscape or portrait flag
accordingly, but I'm wondering if this will disable the accelerometers from
then on (ie: overriding the autorotation flag set before).
Any clue on this?

--
Luca Donaggio

  •  Reply

Re: Qt Autorotation

Felipe Crochik

2010-05-27 12:26 UTC
Luca,
I ran into the same issue - the new windows always start on landscape - and used the same workaround - checked the screen resolution and when taller set the portrait attribute.
And yes, I believe you are right, setting the attribute will disable the autorotation for the new window (does not affect the original one though).
I tried to set the portrait attribute and then the autorotation on the new window but then the window will start again on landscape mode.
One workaround I did not try was to set the portrait attribute and a timer for a little after the window is showing to set the autorotation attribute.
It seems that the "autorotation dispatcher" only check the window attributes after the window is showing and/or on a predefined schedule (maybe it is a bug).
My application (macuco2 on the dev repository if you want to try) seems to take some time after starting to start receiveing the "signals"... Sometimes only starts after you show the menu for the first time.
Felipe

> Felipe, you're absolutely right: once set the autorotation flag in the
> topmost window of the stack, the others seem  to retain it.
> Only issue remaining is that once you open a new stacked window, it
> starts in landscape mode, disregarding current device orientation, *but*
> its child widgets are layed out respecting the correct screen
> proportions. I can check for screen geometry and set the landscape or
> portrait flag accordingly, but I'm wondering if this will disable the
> accelerometers from then on (ie: overriding the autorotation flag set
> before). Any clue on this?
>
> --
> Luca Donaggio


  •  Reply

Re: RE: Qt Autorotation

2010-05-29 04:37 UTC
> My application seems to start "autorotating" after I click on the
> application title to show the menu for the first time. I don't have to
> select anything and I don't do anything different on my code about the
> implementation of the menu.

I have noted something similar. I have enabled autorotation in the constructor of my main window, and the autorotate doesn's start. But if I set it e.g. in a slot called when I press a button, it does.

I can reproduce it with the example code here:

http://doc.qt.nokia.com/qt-maemo-4.6/maemo5-rotation.html

The app starts in "auto rotation" mode, but doesn't rotate until I switch to one of the fixed orientations, and then back to auto-rotate.
  •  Reply

Re: RE: Qt Autorotation

2010-05-30 09:13 UTC
>
> > My application seems to start "autorotating" after I click on the
> > application title to show the menu for the first time. I don't have to
> > select anything and I don't do anything different on my code about the
> > implementation of the menu.
>
> I have noted something similar. I have enabled autorotation in the constructor of my main window, and the autorotate doesn's start. But if I set it e.g. in a slot called when I press a button, it does.
>
> I can reproduce it with the example code here:
>
> http://doc.qt.nokia.com/qt-maemo-4.6/maemo5-rotation.html
>
> The app starts in "auto rotation" mode, but doesn't rotate until I switch to one of the fixed orientations, and then back to auto-rotate.
>

I created a bug in Qt Jira for this, I hope it helps:

http://bugreports.qt.nokia.com/browse/QTBUG-11090
  •  Reply

Re: Qt Autorotation

2010-06-02 22:07 UTC
Hello,

On Thursday 27 of May 2010, Felipe Crochik wrote:
> Luca,
> I ran into the same issue - the new windows always start on landscape - and
> used the same workaround - checked the screen resolution and when taller
> set the portrait attribute. And yes, I believe you are right, setting the

I had the same problem but it proved to be my fault. If you are using QDialogs
like me then you only have to be sure that you're setting the main window (the
one with the portrait mode support) as the parent window. This will give nice
portrait support and QDialogs will start in the proper condition.
  •  Reply
1 2 next