Results 1 to 6 of 6

Thread: QT Resolution solution : Need suggestion

  1. #1
    Join Date
    Sep 2008
    Location
    Chennai
    Posts
    36
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default QT Resolution solution : Need suggestion

    I have developed a static (Using Drag & Drop Method, QT3.3) application in 1280x1024 resolution, but if I execute the same application in some other resolution, the application's window are not showing properly. I have followed one method (Below is the sample code for my Login dialog's controls), but I need to know, is there any other way to solve this resolution conflict in QT ?

    Sample code for Login window -

    Qt Code:
    1. int iw=0,ih=0;
    2. float fwx=0.0f,fhx=0.0f;
    3.  
    4. QDesktopWidget *d = QApplication::desktop();
    5. iw = d->width();
    6. ih = d->height();
    7.  
    8. if(iw !=0 && ih!= 0)
    9. {
    10. /* Finding ratio for other resolution, using this ratio value, the controls and windows to be resized accordingly*/
    11.  
    12. fwx = float(1280 - 2)/float(iw);
    13. fhx = float(1024 - 8)/float(ih);
    14. }
    15.  
    16. QFont qf("Sans",10);
    17. qf.setPointSizeFloat(float(10)/in_fWidthx);
    18.  
    19. LE_UserName->setGeometry(int(float(250)/in_fWidthx),int(float(30)/in_fHeightx),int(float(210)/in_fWidthx),int(float(30)/in_fHeightx));
    20. LE_Password->setGeometry(int(float(250)/in_fWidthx),int(float(70)/in_fHeightx),int(float(210)/in_fWidthx),int(float(30)/in_fHeightx));
    21.  
    22. LE_UserName->setFont(qf);
    23. LE_Password->setFont(qf);
    To copy to clipboard, switch view to plain text mode 


    Thanks in advance ..........
    Last edited by jpn; 25th March 2009 at 16:45. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QT Resolution solution : Need suggestion

    Where do you set in_fWidthx and in_fHeightx? Wouldn't it be easier to use layouts and let Qt do the rest?

  3. The following user says thank you to jacek for this useful post:

    soumyadeep_pan (27th September 2008)

  4. #3
    Join Date
    Sep 2008
    Location
    Chennai
    Posts
    36
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Re: QT Resolution solution : Need suggestion

    Thanks a lot, it is working perfectly, but ..

    I set the value of these 2 as, before using those -

    in_fWidthx = fwx
    in_fHeightx = fhx.

    I want to do it through static (Drag and drop method) way, if I use Layouts, it will automatically resized the controls so what ever controls size I will fixed will not be coming properly as well as the alignment, so is there any other way to fixed it ? Thanks in advance ....

  5. #4
    Join Date
    Sep 2008
    Location
    Chennai
    Posts
    36
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Re: QT Resolution solution : Need suggestion

    Need help regarding the last post .... Thanks in Advance

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QT Resolution solution : Need suggestion

    Could you rephrase your question?

  7. #6
    Join Date
    Sep 2008
    Location
    Chennai
    Posts
    36
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Re: QT Resolution solution : Need suggestion (Related to QT4 also)

    I would be very sorry Jacek that it was a long time, but I did not replied to the thread where I got a suggestion...... Actually when I checked my own old posts I find this thread ......

    As you told, to avoid the resolution problem I should use the layouts, But is it possible to resize/adjust size (static way while designing the UIs) the controls I placed inside any layout ?
    or
    Whenever I use layout for few controls the layout will automatically adjust the size (with minimal size) of the controls, and I can not set the size of the controls statically .... Is there any way to adjust the size ??????


    Thanks in advance .........

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.