table->setSelectionMode(QAbstractItemView::ExtendedSelection); //可多选(Ctrl、Shift、Ctrl+A都可以)
table->setEditTriggers(QAbstractItemView::NoEditTriggers); //设置表格内容不可编辑
table->setStyleSheet("selection-"); //设置选中行的背景色
table->horizontalHeader()->setStyleSheet("QHeaderView::section{background:skyblue;}"); //设置表头的背景色