Differents screens size.
-
Hi to everyone,
I'm developing a simple user interface like a form, my problem is like I want to the program fits with the pixels of the screen, I mean, I want to my program have the elements in the same place, and don't desappear any widget depending on the size of the screen.someone knows how can I do it?
Thanksss!!
-
Hi,
Something is not clear, are you using QtQuick for your interface or QWidget ? The content of your original post and the sub-forum you posted in don't match.
-
@patcs ,
Dont give the fixed size to any widgets. Use setMinimumSize for the widgets.
To get the screen size, You can use the QDesktopWidget,QRect rec = QApplication::desktop()->screenGeometry();
height = rec.height();
width = rec.width(); -
Hi,
adding to @Vinod-Kuntoji ,
u can also use qApp global pointer,QRect m_ScreenSize = qApp->primaryScreen()->geometry();
int width = m_ScreenSize.width();
int height = m_ScreenSize.height();so u can use width and height throughout ur classes .
And will be fit for all platforms,Thanks,
-
@Pradeep-Kumar thanks for info. How to use your code in QML for mobile app development?
QRect m_ScreenSize = qApp->primaryScreen()->geometry();
int width = m_ScreenSize.width();
int height = m_ScreenSize.height();