×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    52

    How to ensure ui adjusts to every device resolution

    Hi all

    I have my mainwindow which has a couple of widgets on there (stackedwidget, Lineedit, listwidget, pushbuttons)

    I have set the layout to the Grid layout but the lineedit and listwidget is always wider than the actual screen.

    I am testing on a Nokia 5800.

    Thanks in advance.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to ensure ui adjusts to every device resolution

    When you set up your main window in Designer, make it smaller in both dimensions than the smallest screen you'll use.

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    210

    Re: How to ensure ui adjusts to every device resolution

    You can also check the screen size of the device and then use an 'if' statement to make adjustments as needed.
    I used the following code to determine if my app was running on a 3rd edition device and then set the max size of the widgets so they would fit and not break the layout.
    Code:
      
      //get screen size
        QDesktopWidget* desktopWidget = QApplication::desktop();
        //get client rect.
        QRect rect = desktopWidget->availableGeometry();
        QSize size(rect.width() , rect.height());
        if(size.width() <= 250 || size.height() <= 300)
        {
            ui->label_3->setMaximumSize(65,65);
            ui->label->setMaximumSize(215,130);
    
        }
    I am not sure if thats the proper method as I am just learning but it worked fine for me.
    Cheers,
    Jon

Similar Threads

  1. how to get the resolution of device in widget?
    By kalpesh_sttl in forum Symbian
    Replies: 3
    Last Post: 2010-10-05, 11:12
  2. Ui Resolution on Different Phone
    By vishalrocks101 in forum Qt
    Replies: 4
    Last Post: 2010-03-12, 11:26
  3. mms and device resolution
    By gumgumok in forum General Messaging
    Replies: 0
    Last Post: 2006-11-27, 08:52
  4. Prototype 4.0 for Java - S60 UI resolution
    By mircearechi in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2006-11-11, 01:06
  5. Series60 Device Resolution
    By earamsey in forum Mobile Java General
    Replies: 1
    Last Post: 2004-06-08, 06: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
  •