PDA

View Full Version : How to make a resolution independent Ui



shivendra46d
24th September 2013, 13:20
Is there any other way to make my Ui resolution independent. Right now i am using my own function to do so


QDesktopWidget *mydesk = new QDesktopWidget() ;
double width = mydesk->width();
double hight = mydesk->height();
X_resolution = width/1600;
Y_resolution = hight/900;

and i am multiplying the controlls by this factor


ui->SRP_labelY_8->setGeometry(static_cast<int>(ui->SRP_labelY_8->pos().x()*X_resolution), static_cast<int>(ui->SRP_labelY_8->pos().y()*Y_resolution), static_cast<int>(ui->SRP_labelY_8->size().width()*X_resolution), static_cast<int>(ui->SRP_labelY_8->size().height()*Y_resolution));

Is there some other way to do so ??

Lesiok
24th September 2013, 14:14
Is the layout manager does not solve your problem ?

wysota
24th September 2013, 21:08
For resolution independent UI one would usually use QtQuick.