×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    How to set fixed background size for N8 / Symbian device?

    How can I set a fixed background to fit perfectly for N8 (and other symbian device if possible)? There's no problem with the display if I only have the buttons and spacers. It is displayed on all Symbian simulator devices correctly.



    My problem comes in if I add a fixed background(not repeated) to the form/frame.

    I tried getting the geometry using N8 Symbian simulator with this code:
    QDesktopWidget* desktopWidget = QApplication::desktop();
    QRect appRect = desktopWidget->screenGeometry();

    And appRect returned:
    x1 0
    x2 359
    y1 -92
    y2 547

    Is it correct to assume that x2 is width and y2 is height? I tried setting my form's width and height to those figures explicitly, then adjusted my image to have 359x547 resolution, it still doesnt show the whole image. The background image is still too big.

    I added the background image in a frame using this code:
    ui->frame->setStyleSheet("background-image: url(./mainPage.png);"
    "background-repeat: no-repeat;"
    "background-position: top center;");

    What's the correct way? Also, I only need this to be shown in portrait mode.

    Thanks in advance!

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to set fixed background size for N8 / Symbian device?

    can you try on device. yes on simulator it is giving wrong QRect

  3. #3
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    Re: How to set fixed background size for N8 / Symbian device?

    Unfortunately, I can't try it on the actual device yet.

    On Visual Studio for Windows Phone, the GUI has the actual phone's image, so if you need to apply a background image, you can just add the image and just adjust the size to fit the screen. I wish Qt is also like that. Or maybe there's away, I'm just having a hard time figuring it out.

    Edit:
    If ever I do get the correct QRect, how do I set the image to fit the screen perfectly? Edit the image width and height? or the form/frame itself?

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to set fixed background size for N8 / Symbian device?

    There is a way but that will need you to use Qt for Symbian on Top of Symbian ^3 SDK which will then use Symbian^3 Emulator which will give you correct QRect.

  5. #5
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    Re: How to set fixed background size for N8 / Symbian device?

    Edit:
    If ever I do get the correct QRect, how do I set the image to fit the screen perfectly? Edit the image width and height? or the form/frame itself?

    Does adding the image on a frame/label and setting the stylesheet for the background enough to solve my problem assuming I get the correct QRect? Then just layout everything in a form or grid layout?

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to set fixed background size for N8 / Symbian device?

    layout might depend on your implementation but i prefer to have grid layout every where as main layout

  7. #7
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set fixed background size for N8 / Symbian device?

    If your application is full screen (no standard status area and softkeys at the top/bottom) then all S60 5th Edition devices and all Symbian^3 devices (like N8) launched so far have the same screen resolution - 640x360.

    If your application is just shown maximized and not full screen then you don't want to get your background size from the QDesktopWidget, just from your app's (i.e. main window or widget) own rectangle.

    If you want to develop a full-screen app on the simulator then make sure you set it to full screen for all platforms in your main function (Qt Creator puts a #ifdef for Symbian/S60 in by default).

  8. #8
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    Re: How to set fixed background size for N8 / Symbian device?

    I need it fullscreen (unless having a virtual keyboard for inputs will affect it).

    I made a test program with the background. I put the background image in a label, on top of it are the buttons. They are all laid out as grid to the form. Form is set to 640x360(portrait) as well as image.

    http://img266.imageshack.us/img266/7205/designerl.jpg

    The result is this:
    http://img708.imageshack.us/img708/5483/withbg.jpg

    You can see the whole background image in Maemo. I need that to fit the N8 screen. But as you can see, the image background was still cut in N8. Does it show differently on actual devices? Or is there a special scale that I need the image to adjust to?

    Thanks.

  9. #9
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set fixed background size for N8 / Symbian device?

    If you use the new project wizard to generate your project then the main function in main.cpp looks like this:
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    #if defined(Q_WS_S60)
    w.showMaximized();
    #else
    w.show();
    #endif

    return a.exec();
    }
    For a full screen application on the device, change w.showMaximized() to w.showFullScreen().

    Q_WS_S60 is not defined in the simulator, even if it does have a Symbian device skin. To make it look right in the simulator too then do something like:
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.showFullScreen();
    return a.exec();
    }
    Note that this makes your cross-platform Qt app full screen on every single platform, but if you're using a device screen size specific bitmap, you probably don't care about that.

  10. #10
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    Re: How to set fixed background size for N8 / Symbian device?

    @Sorcery-ltd, yes I used the project wizard. And I actually did try w.showFullScreen() yesterday and it did fix my problem, so long as my background image is 640x360 for portrait. But noticed, when I hover the mouse at the bottom screen when using showFullScreen(), the area is still clickable even though you can't see the 2 blue default buttons at the bottom. How can I manipulate the 2 buttons?

    Another problem when I used showFullScreen() is that, it made the animated screen transition(from Form1 to Form 2, Form2 should slide from bottom to up) to fail. It was working fine with show().

    This is what I used for the transition:

    Form2 *frm2= new Form2 ;
    //this->hide();
    frm2->showFullScreen();

    //animate form from down to up
    QPropertyAnimation *animateForm = new QPropertyAnimation(frm2, "pos", this);
    animateForm->setDuration(200);
    animateForm->setStartValue(QPoint(0, this->height()));
    animateForm->setEndValue(QPoint(0,0));
    animateForm->setEasingCurve(QEasingCurve::InBounce);
    animateForm->start();

    The above code works fine if I use show(). Form2 transitions smoothly from bottom to top, on top of Form1. Now when I use showFullScreen, both in main() and in calling Form2, Form1 remains on top and I can't see Form2 loading. I need to use Form1->hide() to see Form2 but I don't want to hide Form1.

    Do you know what I'm missing or did wrong? :/
    Last edited by vilmavaliente; 2011-01-14 at 05:28.

  11. #11
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: How to set fixed background size for N8 / Symbian device?

    hi

    try to use raise() on form2
    Symbian & Qt developer. http://vladest.org

  12. #12
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    Re: How to set fixed background size for N8 / Symbian device?

    Form2 *frm2= new Form2 ;
    frm2.>raise();
    frm2->showFullScreen();

    Nothing happen in the display. I also tried:
    frm2->showFullScreen();
    frm2.>raise();

    same.

  13. #13
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set fixed background size for N8 / Symbian device?

    @Sorcery-ltd, yes I used the project wizard. And I actually did try w.showFullScreen() yesterday and it did fix my problem, so long as my background image is 640x360 for portrait. But noticed, when I hover the mouse at the bottom screen when using showFullScreen(), the area is still clickable even though you can't see the 2 blue default buttons at the bottom. How can I manipulate the 2 buttons?
    The 2 blue buttons are softkeys - if you genuinely run full screen then they shouldn't be displayed. How do you want to manuipulate them? This is just a quirk of the simulator - you can call it a "feature" or a bug depending on how you look at it. On the real device there will be nothing clickable there unless you put it there.

    I don't know why your animation broke but animations use the QGraphicsView infrastructure - it is your view that should be full screen, not the individual forms that animate on it.

  14. #14
    Regular Contributor
    Join Date
    Jan 2011
    Posts
    122

    Re: How to set fixed background size for N8 / Symbian device?

    I don't know why your animation broke but animations use the QGraphicsView infrastructure - it is your view that should be full screen, not the individual forms that animate on it.
    Is there something wrong with my animation implementation on Form2?

    When designing a form, should I just set the geometry to 640x360 and base all the other widgets from there? I mean layout to grid/horizontal/vertical other widgets on that size if I have a fixed background 640x360? I tried not minding the form's size and it's ok so long as I don't have a fix background.

    Anyway, maybe I'll just ask some tips on how to properly search how to implement apps on N8? Like what versions should I consider when developing for N8 and the likes. Cause there are times that the suggested solutions don't seem to work like classes are no longer included. There are lots of Symbians right? And topics here are all mixed up I think.

    Also, I'd like to ask if I'm using the correct version. I did follow the installation guide for Symbian but I'm not sure if it's the correct one for N8. I have Qt Creator 2.0.1 based on Qt 4.7.0. And I'm using the Symbian^3 Simulator to test my program since I still don't have the N8 device(I believe that is the one used for N8, please correct me if I'm wrong). I have 4.7.1 symbian installed. I also have Carbide C++ installed but I don't know how and when to use it. And Perl.

  15. #15
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set fixed background size for N8 / Symbian device?

    You've done a lot of work to get all that stuff installed. You should only need to install the Nokia Qt SDK - just that one download and install. The current version only supports Qt 4.6.3 for Symbian (including the N8) but there'll be a new version out very soon if you need Qt 4.7.x features. Note that you can't deploy to the Ovi Store yet with Qt 4.7.x - that should be resolved around the end of this quarter I've heard.

    If you are going to use Qt 4.7 anyway, why not use QML to build your UI?

Page 1 of 2 12 LastLast

Similar Threads

  1. Icon size for Symbian^3 / Nokia N8
    By clapfoot in forum Symbian Media (Closed)
    Replies: 18
    Last Post: 2011-05-30, 18:07
  2. Replies: 0
    Last Post: 2010-12-16, 06:58
  3. how to initilize fixed size array in python S60
    By pavan.pareta in forum Python
    Replies: 5
    Last Post: 2009-01-29, 05:35
  4. How to set the memory size of emulator to match with the actual device ?
    By akokchai in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2003-05-08, 10:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •