Results 1 to 6 of 6

Thread: QT Resolution solution : Need suggestion

Threaded View

Previous Post Previous Post   Next Post Next Post
  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 17:45. Reason: missing [code] tags

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.