Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Position widgets by pixel



  • Hi, I need to position my app views (widgets) using absolute coordinates.
    I have been reading about problems using absolute coordinates, and I would like to use a grid layout, I'm not sure how. My app will run on different sized monitors but the main window cannot be resized.
    I have a configuration file that gives exact position coordinates for views in a given size screen. For example, we want a couple of 250x250 rectangles at the right upper corner and the right bottom corner:
    screenwidth = 1920
    screenheight = 1080

    [Layout]
    views = [ "A", "B"]

    [A]
    left = 1670
    top = 0
    width = 250
    height = 250

    [B]
    left = 1670
    top = 830
    width = 250
    height = 250

    How can I tell a grid layout to keep spaces between the widgets? How can I translate absolute coordinates to grid coordinates?


  • Lifetime Qt Champion

    Positioning widgets pixel-exact and using layouts contradicts each other.


Log in to reply