soumyadeep_pan
25th September 2008, 07:25
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 -
int iw=0,ih=0;
float fwx=0.0f,fhx=0.0f;
QDesktopWidget *d = QApplication::desktop();
iw = d->width();
ih = d->height();
if(iw !=0 && ih!= 0)
{
/* Finding ratio for other resolution, using this ratio value, the controls and windows to be resized accordingly*/
fwx = float(1280 - 2)/float(iw);
fhx = float(1024 - 8)/float(ih);
}
QFont qf("Sans",10);
qf.setPointSizeFloat(float(10)/in_fWidthx);
LE_UserName->setGeometry(int(float(250)/in_fWidthx),int(float(30)/in_fHeightx),int(float(210)/in_fWidthx),int(float(30)/in_fHeightx));
LE_Password->setGeometry(int(float(250)/in_fWidthx),int(float(70)/in_fHeightx),int(float(210)/in_fWidthx),int(float(30)/in_fHeightx));
LE_UserName->setFont(qf);
LE_Password->setFont(qf);
Thanks in advance ..........
Sample code for Login window -
int iw=0,ih=0;
float fwx=0.0f,fhx=0.0f;
QDesktopWidget *d = QApplication::desktop();
iw = d->width();
ih = d->height();
if(iw !=0 && ih!= 0)
{
/* Finding ratio for other resolution, using this ratio value, the controls and windows to be resized accordingly*/
fwx = float(1280 - 2)/float(iw);
fhx = float(1024 - 8)/float(ih);
}
QFont qf("Sans",10);
qf.setPointSizeFloat(float(10)/in_fWidthx);
LE_UserName->setGeometry(int(float(250)/in_fWidthx),int(float(30)/in_fHeightx),int(float(210)/in_fWidthx),int(float(30)/in_fHeightx));
LE_Password->setGeometry(int(float(250)/in_fWidthx),int(float(70)/in_fHeightx),int(float(210)/in_fWidthx),int(float(30)/in_fHeightx));
LE_UserName->setFont(qf);
LE_Password->setFont(qf);
Thanks in advance ..........