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?


  • 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.

  • Someone could help me, please?

  • Lifetime Qt Champion


    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,


  • I fixed it with layouts! But thank you a lot.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.