How to add space b/w column and rows of gridlayout.
Hi
I am trying to add space b/w rows and column of gridlayout but it is not working.
I have 2*2 gridlayout like the following
Code:
layout->setAlignment(Qt::AlignCenter);
layout->addWidget(button_panic, 0, 0);
layout->setHorizontalSpacing(5);
layout->addWidget(button_gas, 0, 1);
layout->setVerticalSpacing(5);
layout->addWidget(button_alarm, 2, 0);
layout->setHorizontalSpacing(5);
layout->addWidget(button_fire, 2, 1);
this->setLayout(layout);
How to add space b/w widgeta laid in layout.
Re: How to add space b/w column and rows of gridlayout.
Code:
layout->setAlignment(Qt::AlignCenter);
layout->addWidget(button_panic, 0, 0);
layout->addWidget(button_gas, 0, 1);
layout->addWidget(button_alarm, 1, 0); //check the row number
layout->addWidget(button_fire, 1, 1);
layout->setSpacing(50);
Re: How to add space b/w column and rows of gridlayout.
I am assuming that "b/w" means between.
QGridLayout::setHorizontalSpacing() and QGridLayout::setVerticalSpacing(), which you are already using, set the space between adjacent widgets in the grid. You are asking for 5 pixels between rows and 5 pixels between columns. What is "not working" ?
Re: How to add space b/w column and rows of gridlayout.
hi,
ur code is correct.its working.
may i know the error u got?