Reduce space(h and v) between icon in QGridlayout
-
Hi
The below code displays some icons in gridlayout.i trying to reduce the horizantal space between the icons , but i could not .
please give me a hint on what are the function i can use to reduce the space(H and V ) between the icons in a laid out in a gridlayout.
@QGridLayout controlsLayout = new QGridLayout();
QGridLayout *controlsLayout2 = new QGridLayout();
controlsLayout2->setHorizontalSpacing(0);
QWidget *widg = new QWidget;
setLayout(controlsLayout);// set to mainWindow
controlsLayout->addWidget(widg);
widg ->setLayout(controlsLayout2);appWidget[app_no]= new QWidget();
appWidget[app_no]->setFixedSize(78, 78);q_Icon[app_no]=new QPushButton(); q_Icon[app_no]->setFlat(TRUE); q_Icon[app_no]->setFixedSize(60,50); QPixmap pixmap(somepath); QIcon ButtonIcon(pixmap); q_Icon[app_no]->setIcon(ButtonIcon); label[app_no]= new QLabel(this, 0); label[app_no]->setMaximumSize(73,20); label[app_no]->setAlignment(Qt::AlignTop|Qt::AlignCenter); label[app_no]->setFont(font); label[app_no]->setText("<font color = 'white'>"+QString(label_text_list[0])); label[app_no]->setFrameStyle(QFrame::NoFrame); label[app_no]->setAttribute(Qt::WA_TranslucentBackground, true); appLayout[app_no] = new QVBoxLayout(); appLayout[app_no]->addWidget(q_Icon[app_no]); appLayout[app_no]->setSpacing(0); appLayout[app_no]->addWidget(label[app_no]); appLayout[app_no]->sizeConstraint(); appWidget[app_no]->setLayout(appLayout[app_no]); controlsLayout2->addWidget(appWidget[app_no], row_n, col_n, 10, 2, Qt::AlignTop|Qt::AlignLeft);@
-
Hi,
I want the size of button to be remain constant .
is it a wrong way to do, i really dont know much of Qt?
i just used by following some examples and some manuals on net.my problem is , when the mainwindow is minimized the distance between icons is less, but when it is maximized the distance also increasing.