Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
ejcommon.cpp 778 Bytes
Copy Edit Web IDE Raw Blame History
unix_chen authored 2018-03-26 07:59 . init
#include "ejcommon.h"
#include <QHeaderView>
QTableWidget * CreateQTableWidget(QWidget *parent, QStringList &list)
int columns = list.size();
auto table = new QTableWidget(0, columns, parent);
table->setSelectionMode(QAbstractItemView::ExtendedSelection); /*设置可多选*/
table->setSelectionBehavior(QAbstractItemView::SelectRows); /*设置整行选择*/
table->setHorizontalHeaderLabels(list); /*设置表头*/
//table->setEditTriggers(QAbstractItemView::NoEditTriggers); /*将表格变为禁止编辑*/
table->verticalHeader()->setVisible(false); /*设置垂直表头不可见*/
table->setFrameShape(QFrame::NoFrame); /*设置没有边框*/
return table;

Comment ( 0 )

Sign in for post a comment