|
QIcon icon = QIcon("./images/bad.svg");
table1=new QTableWidget(this);
table1->setGeometry(0,0,520,300);
table1->setRowCount(5);
table1->setColumnCount(5);
QTableWidgetItem *newItem = new QTableWidgetItem;
newItem->setText(tr("表格测试"));
newItem->setTextAlignment(Qt::AlignVCenter);
//Qt::AlignLeft / Qt::AlignRight / Qt::AlignHCenter / Qt::AlignJustify
//Qt::AlignTop / Qt::AlignBottom / Qt::AlignVCenter / Qt::AlignCenter
newItem->setIcon(icon);
table1->setItem(0,0,newItem);
table1->setHorizontalHeaderItem(0,newItem); //setVerticalHeaderItem |
|