Differents screens size.
-
wrote on 16 Jun 2017, 07:13 last edited by
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!!
-
wrote on 16 Jun 2017, 07:31 last edited by patcs
I forgot to say that my program has been developed in QtCreator so I had a lot of widgets and when I change the resolution of the screen like for example Table or Iphone, some widgets were detaching.
-
wrote on 20 Jun 2017, 06:37 last edited by
Someone could help me, please?
-
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.
-
wrote on 21 Jun 2017, 04:55 last edited by
@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(); -
wrote on 21 Jun 2017, 08:00 last edited by
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,
-
wrote on 22 Jun 2017, 08:57 last edited by
I fixed it with layouts! But thank you a lot.
-
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,
wrote on 15 Feb 2018, 13:57 last edited by@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();