[英]How to set multiple checkboxes in one merged cell?
您必須創建一個具有布局(水平或垂直)的 QWidget,然后將復選框添加到布局中,如下所示:
QWidget *widget = new QWidget();
QHBoxLayout *horizontalLayout = new QHBoxLayout(widget);
QCheckBox *cb = new QCheckBox(widget);
cb->setText("First");
QCheckBox *cb2 = new QCheckBox(widget);
cb2->setText("Second");
widget ->layout()->addWidget(cb); //adding to layout the first checkbox
widget ->layout()->addWidget(cb2);//adding to layout the second checkbox
//Your code
my_table->setCellWidget(1,2, widget);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.