Is there a way to center buttons in a table?
I tried to add a layout with button inside to the table. It compiled but died during run.
Failed code:
//QHBoxLayout *hLayout;
for(int i = 0; i < 128; i++) {
but1->setMaximumSize(100, 16777215);
connect(but1, SIGNAL(clicked()), this, SLOT(onSRegRead()));
hLayout->addWidget(but1);
SRegTable
->setCellWidget
(i, SREG_COL_READ,
(QWidget *) hLayout
);
}
QPushButton *but1;
//QHBoxLayout *hLayout;
QGridLayout *hLayout;
for(int i = 0; i < 128; i++) {
but1 = new QPushButton("Read");
but1->setMaximumSize(100, 16777215);
connect(but1, SIGNAL(clicked()), this, SLOT(onSRegRead()));
hLayout = new QGridLayout();//QHBoxLayout();
hLayout->addWidget(but1);
SRegTable->setCellWidget(i, SREG_COL_READ, (QWidget *) hLayout);
}
To copy to clipboard, switch view to plain text mode
Bookmarks