设置无边框(标题栏)的应用程序
QApplication a(argc, argv);
MainWindow w;
w.setWindowOpacity(1);
w.setWindowFlags(Qt::FramelessWindowHint);
w.setAttribute(Qt::WA_TranslucentBackground);
w.show(); [size=; font-size:10.5000pt,10.5000pt][font='Times New Roman']
QTableWidgte
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); 选择行
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); 单一选组
ui->tableWidget->clearSelection();取消选中
ui->tableWidget->setEditTriggers ( QAbstractItemView::NoEditTriggers );禁止编辑
删除行函数
QItemSelectionModel *selectionModel = ui->tabl->selectionModel();//获得当前的模型类型
QModelIndexList selected = selectionModel->selectedIndexes(); //获得选择项的列表,即选择
QMap<int, int> rowMap; 了哪几行
foreach (QModelIndex index, selected)//记录已选择行的<键,值>对
rowMap.insert(index.row(), 0);
int rowToDel; //记录当前删除行
//定义一个迭代器,并定位rowmap的反面
QMapIterator<int, int> rowMapIterator(rowMap);
rowMapIterator.toBack();
while (rowMapIterator.hasPrevious())
{
rowMapIterator.previous();
rowToDel = rowMapIterator.key();
ui->tabl->removeRow(rowToDel);[size=font-size: 10.5pt,10.5pt][font='Times New Roman']
}