table->setFocusPolicy(Qt::NoFocus);
或者是
table->viewport()->setFocusPolicy(Qt::NoFocus);
不过这样的话,无法使用键盘控制table了.
改变选中行的颜色:
ui->Tablewidget->setStyleSheet("QTableWidget::item:selected { background-color: rgb(255,235,205) }");
table->setFocusPolicy(Qt::NoFocus);
或者是
table->viewport()->setFocusPolicy(Qt::NoFocus);
不过这样的话,无法使用键盘控制table了.
改变选中行的颜色:
ui->Tablewidget->setStyleSheet("QTableWidget::item:selected { background-color: rgb(255,235,205) }");