QTableWidget QTableView 选中虚框问题
来源:互联网 发布:java程序员更是 编辑:程序博客网 时间:2024/05/07 16:35
原址:http://stackoverflow.com/questions/2055705/hide-the-border-of-the-selected-cell-in-qtablewidget-in-pyqt
3down vote
It looks like this dotted border around selected cell you're trying to hide is a focus rectangle. Any given cell can have focus and not be selected at the same time and vice-versa. If you want this border to not get painted use an item delegate. There you can remove State_HasFocus style from the item's state before painting it. Pls, see an example below on how to do this, it's c++, let me know if you have troubles converting it to python
// custom item delegate classclass NoFocusDelegate : public QStyledItemDelegate{protected: void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;};void NoFocusDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const{ QStyleOptionViewItem itemOption(option); if (itemOption.state & QStyle::State_HasFocus) itemOption.state = itemOption.state ^ QStyle::State_HasFocus; QStyledItemDelegate::paint(painter, itemOption, index);}...// set the item delegate to your table widgetui->tableView->setItemDelegate(new NoFocusDelegate());
- QTableWidget QTableView 选中虚框问题
- QTableWidget&&QTableView
- Qtablewidget / Qtableview
- 关于QTableView和QTableWidget设置代理的相关问题
- qtableview和qtablewidget区别
- Qt QTableWidget 和 QTableView
- QTableWidget和QTableView
- Qt on Android:QTableView不显示选中虚框
- QTableWidget与QTableView的区别
- QTableWidget和 QTableView翻页效果
- QTableWidget与QTableView的区别
- QTableWidget与QTableView的区别
- QTableWidget与QTableView的区别
- QTableWidget与QTableView的区别
- QTableWidget与QTableView的区别
- QTableWidget和QTableView的区别
- qt QTableView/QTableWidget样式设置
- QTableWidget与QTableView的区别
- Eclipse导入Android工程,出现default与Displaying的问题解决
- 学习软件开发应该看的书
- 西班牙列车推出QR码阅读新方式
- dsoframer控件学习小结
- struts2在Action中访问request、session、application属性
- QTableWidget QTableView 选中虚框问题
- shell 中的[: -eq: unary operator expected
- Linux 文件夹 压缩 命令
- 修改题注样式
- select 多选 左右框添加删除
- 利用pdfbox完成文档制作
- ++i, i++, printf 和 程序的可移植性 问题
- Android4.0 与 android2.3 差异
- Word 2007-破解只能浏览而不能编辑的文档