Can't seem to get widgets in a layout spaced the way I want.
// panel_1 class
int w = 50;
int h = 100;
layout_1->setSpacing(0);
layout_1->addWidget(pbStart);
lineEdit1->setFixedSize(w, h);
lineEdit2->setFixedSize(w, h);
lineEdit3->setFixedSize(w, h);
layout_1->addWidget(lineEdit1);
layout_1->addWidget(lineEdit2);
layout_1->addWidget(lineEdit3);
// mainwindow class
layout->setSpacing(1);
panel_1 = new Panel_1();
layout->addWidget(panel_1);
layout->addWidget(d_.view);
widget->setLayout(layout);
setCentralWidget(widget);
// panel_1 class
int w = 50;
int h = 100;
pbStart = new QPushButton("Start");
QHBoxLayout *layout_1 = new QHBoxLayout(this);
layout_1->setSpacing(0);
layout_1->addWidget(pbStart);
lineEdit1 = new QLineEdit(this);
lineEdit2 = new QLineEdit(this);
lineEdit3 = new QLineEdit(this);
lineEdit1->setFixedSize(w, h);
lineEdit2->setFixedSize(w, h);
lineEdit3->setFixedSize(w, h);
layout_1->addWidget(lineEdit1);
layout_1->addWidget(lineEdit2);
layout_1->addWidget(lineEdit3);
// mainwindow class
QWidget *widget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(1);
panel_1 = new Panel_1();
layout->addWidget(panel_1);
layout->addWidget(d_.view);
widget->setLayout(layout);
setCentralWidget(widget);
To copy to clipboard, switch view to plain text mode
The space between the pb and the line edits and between the edits is constant - about 2"
Checking spacing() with debug, it reports 0.
What am I doing wrong that's not letting me set the spacing to what I need?
Thanks for any help.
Bookmarks