PyQt/QComboBox/README.md
2019-03-12 12:47:56 +08:00

15 lines
No EOL
480 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# QComboBox
- 目录
- [下拉数据关联](#1、下拉数据关联)
## 1、下拉数据关联
[运行 CityLinkage.py](CityLinkage.py)
一个省市区关联的三级联动数据源在data.json中
1. 主要用了`QComboBox`的`setModel`设置一个`QSortFilterProxyModel`过滤模型
2. 并根据唯一编码过滤,为了不影响内容显示,唯一编码的角色为`ToolTipRole`
3. 用`QColumnView`可以实现类似效果
![CityLinkage](ScreenShot/CityLinkage.gif)