Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Controlling the margin/Padding in a QGridLayout

$
0
0
Hi all, 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);    but1->addAction(a);      QToolButton * but2=new QToolButton(this);    but1->addAction(b);      QToolButton * but3=new QToolButton(this);    but1->addAction(c);      QToolButton * but4=new QToolButton(this);    but1->addAction(d);      QGridLayout *mLayout=new QGridLayout(this);      mLayout->addWidget(but1,0,0);    mLayout->addWidget(but2,0,1);    mLayout->addWidget(but3,1,0);    mLayout->addWidget(but4,1,1);      QWidget *mWidget=new QWidget(this);    mWidget->setLayout(mLayout);      ui->mainToolBar->insertWidget(a,mWidget);    ui->mainToolBar->setMovable(false); Any help would be appreciated.Thanks

Viewing all articles
Browse latest Browse all 13965

Trending Articles