QTableWidget的openPersistentEditor去掉高亮选择
如果用QTableWidget作为一个表格编辑控件的话,简单的做法就是openPersistentEditor,但是缺省的编辑器如果是文本框或SpinBox的话会高亮选择内容,这个比较讨厌。可以用如下代码将高亮选择去掉:
QList<QLineEdit*> lstLineEditors = ui.m_pTableWidget->findChildren<QLineEdit*>();
foreach(QLineEdit* pLineEdit, lstLineEditors)
{
pLineEdit->deselect();
pLineEdit->clearFocus();
}
SpinBox类似不赘述。