Still having issues with Controlling the margin/Padding in a QGridLayout
I am trying to stack a bunch of Toolbuttons inside a Widget so I can insert the widget in a toolbar.But I am getting margins or paddings that are not desired.I have tried setMargin on the Layout to no avail .Also I have tried to give the widget a fixed height and they unacceptably shrunk!Following is my code:
QAction * a = fileMenu->addAction("AAA");QToolButton * but1=new QToolButton(this);
QToolButton * but2=new QToolButton(this);
QToolButton * but3=new QToolButton(this);
QToolButton * but4=new QToolButton(this);
QGridLayout *mLayout=new QGridLayout(this);
QWidget *mWidget=new QWidget(this);
Any help would be appreciated.Thanks
raven-worx Moderators last edited by
did you try settings the "margins":http://qt-project.org/doc/qt-4.8/qlayout.html#getContentsMargins and "spacing":http://qt-project.org/doc/qt-4.8/qgridlayout.html#setSpacing the correct way?
Thanks ravin-worx,I kind of had missed that.Setting the spacing solved my problem.
I have used the above code to build a toolbar but I am getting unwanted margins in my toolbar.The toolbar I am getting can be seen here": http://www.blikoon.com/?attachment_id=1537 .I want to get rid of the spaces in between .I have used setContentMargins and setSpacing and no luck so far.
I am using Qt 4.8.1 and some of my google searches pointed out that this might be a bug in the Qt libraries.Does anybody know any workaround on this?It would really help.