标签:
实现思路:把QCheckBox嵌入式到一个水平布局中
获取CheckBox的指针的方法
备注: 可使用 qDebug() << widget->children(); 输出widget的child列表 从而判断CheckBox的index
转自:http://blog.csdn.net/it_mac/article/details/8953191
-------------------------------------------------------------------------自学笔记-------------------------------------------------------------------------
//开关按钮
QWidget* widget = new QWidget();
QToolButton* switchBtn = new QToolButton(widget);
switchBtn->setFixedSize(QSize(nWidth, nHeight));
switchBtn->setText("关");
switchBtn->setStyleSheet(offStyle);
QHBoxLayout* hLayout = new QHBoxLayout(widget);
hLayout->setMargin(0);
hLayout->addWidget(switchBtn);
hLayout->setAlignment(switchBtn, Qt::AlignCenter);
devTableWidget->setCellWidget(row, column, widget);
connect(switchBtn, SIGNAL(clicked()), switchMapper, SLOT(slot_switchBtn()));
//获取按钮指针 QToolButton*toolBtn=(QToolButton*)devTableWidget->cellWidget(row,column)->children().at(0);
在QTableWidget中添加QCheckBox并使其居中显示(转)
标签:
原文地址:http://www.cnblogs.com/yelanggu/p/4178167.html