This may scratch your itch depending on how fussy you are about the lines.
#include "widget.h"
#include <QGridLayout>
#include <QVBoxLayout>
#include <QFrame>
#include <QLabel>
#include <QLineEdit>
{
setStyleSheet(
QStringLiteral(
"QFrame { border: 1px solid blue; } "
"QLabel, QLineEdit { padding: 5px; border: 1px solid blue; } "
)
);
layout->addWidget(frame);
gridLayout->setSpacing(0);
gridLayout->setMargin(0);
for (int row = 0; row < 4; ++row) {
gridLayout->addWidget(label, row, 0);
gridLayout->addWidget(edit, row, 1);
}
}
Widget::~Widget()
{
}
#include "widget.h"
#include <QGridLayout>
#include <QVBoxLayout>
#include <QFrame>
#include <QLabel>
#include <QLineEdit>
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
setStyleSheet(
QStringLiteral(
"QFrame { border: 1px solid blue; } "
"QLabel, QLineEdit { padding: 5px; border: 1px solid blue; } "
)
);
QVBoxLayout *layout = new QVBoxLayout(this);
QFrame *frame = new QFrame(this);
layout->addWidget(frame);
QGridLayout *gridLayout = new QGridLayout(frame);
gridLayout->setSpacing(0);
gridLayout->setMargin(0);
for (int row = 0; row < 4; ++row) {
QLabel *label = new QLabel(QString("Row %1").arg(row), this);
QLineEdit *edit = new QLineEdit(this);
gridLayout->addWidget(label, row, 0);
gridLayout->addWidget(edit, row, 1);
}
}
Widget::~Widget()
{
}
To copy to clipboard, switch view to plain text mode
Bookmarks