Important: Please read the Qt Code of Conduct -

View position of top-left corner

  • Hi all. I'm new in Qt and i start to develop a simple UI with the Qt4.8.6 library and i have a question: i create a new empty widget with this two QPushButtons and i try to positioning it in the top-left corner of my widget. ( )
    But if i set the x,y coordinates of my first PushButton to 0,0, the button is positioned not in the real top-left corner but in 5,4: in fact, to obtain the situation of the image i had to set my PushButton position to -5,-4. My question is: why this behaviour?

    I also set fixed size of this two PushButton to 150x150, but i had to set my second PushButton x coordinate to 133 (instead of 150) to put it in the first button right-side. I think this is a very newbie question but: why x = 150 is the wrong coordinate? it seems that there is a rectangle that surround the image of the real clickable button, but why? Thanks all for the answers.

    EDIT: i forgot to tell that i also try to put all button in a QGridLayout, but the "padding" still present.

Log in to reply