PDA

View Full Version : QT Resolution solution : Need suggestion



soumyadeep_pan
25th September 2008, 08: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 ..........

jacek
26th September 2008, 23:43
Where do you set in_fWidthx and in_fHeightx? Wouldn't it be easier to use layouts and let Qt do the rest?

soumyadeep_pan
27th September 2008, 10:56
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 ....

soumyadeep_pan
9th October 2008, 06:49
Need help regarding the last post .... Thanks in Advance

jacek
19th October 2008, 23:46
Could you rephrase your question?

soumyadeep_pan
25th March 2009, 11:05
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 .........