Important: Please read the Qt Code of Conduct -

How to move a QPushButton inside gridLayout?

  • I have just tried a simple thing, in designer I created one push button, inside grid layout. The problem is geometry option got disabled in Property box, and I am not able to change the cordinates. In this situation how should I move the push button from its original place if required?

    Can somebody help me to achieve this??

  • Lifetime Qt Champion

    Since a layout arrange its members , you are not allowed to use the geometry to just freely set it.

    You can however move it around in the grid by dragging.

    Or if you insert from code

    MyGridLayout->addWidget(new QPushButton("Button"), ROW, COL);

  • @mrjj I tried it but it didn't worked, however I found the solution for it.
    Break the Layout, arrange the widgets and then set the layout

Log in to reply