![]() ![]() |
Sep 19 2004, 12:37 AM
Post
#1
|
|
|
Group: Members Posts: 58 Joined: 22-August 03 From: Houston / London Member No.: 374 |
I'm writing a qtopia app which I would like to have a different graphical template depending on if it is running on my 5500 or 860. Since I'm using images I will need to scale the images up by a factor if they are on the 860.
Anyone know the options for detecting the resolution (so I can then set a scale factor) from qpeapplication? I have looked at doing it from my main qwidget (with width() and height()) but I tend to not get the right info at the beginning of the app anyway. I would also like to use a different layout if it is landscape versus portrait. For this I will probably just compare the width and height. If anyone has other suggestions please let me know. |
|
|
|
Sep 19 2004, 01:54 AM
Post
#2
|
|
|
Group: Members Posts: 437 Joined: 3-February 04 From: N54°22.5' E10°08.2' Member No.: 1,678 |
With
QApplication::desktop()->width() QApplication::desktop()->height() you will get, what you need. z. |
|
|
|
Sep 19 2004, 10:20 AM
Post
#3
|
|
|
Group: Members Posts: 58 Joined: 22-August 03 From: Houston / London Member No.: 374 |
Thanks. It works a treat. I had looked around for a while but hadn't come across those...
|
|
|
|
Sep 26 2004, 02:15 AM
Post
#4
|
|
|
Group: Members Posts: 58 Joined: 22-August 03 From: Houston / London Member No.: 374 |
Is there an event that is emitted when the screen is rotated?
The only way I have been able to find to deal with rotation is to remember the original rotation, and if the rotation changes then scale everything to the different perspective. ie. original_rotation = AppLnk::rotation(); ... void draw() { if (original_rotation != AppLnk::rotation()) scale(); ... } |
|
|
|
Sep 26 2004, 06:40 AM
Post
#5
|
|
|
Group: Members Posts: 1,497 Joined: 12-November 03 From: Germany Member No.: 907 |
The Opie launcher sends setRotation via QCOP to QPE/System. See
Opie-Camera for how to receive rotation notifications and act upon them. Note that I'm not sure if Qtopia does the same. |
|
|
|
Sep 26 2004, 07:56 AM
Post
#6
|
|
|
Group: Members Posts: 280 Joined: 17-March 04 From: Osaka, Japan Member No.: 2,375 |
When the screen is rotated, it causes a QResizeEvent to be emitted. In your main widget (or any widget), you can override the 'resizeEvent' function to handle this.
For example: CODE void myApp::resizeEvent( QResizeEvent * ev ) { // change layout according to screen orientation if( ev->size().width() > ev->size().height() ) { // landscape mode } else { // portrait mode } QWidget::resizeEvent(ev); } - ashikase anpachi, gifu, japan |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 20th May 2013 - 07:22 AM |