QCombBox
currentIndexChanged 事件只在切换时触发,当只有一个item时不会触发!
- 比如:QQ登录下拉框,选中后可编辑。需要
.setEditable(True) .setLineEdit(self.edit_ctl) .setView(QListView()) # QComboBox QAbstractItemView::item 才能生效 .itemData(index) QSettings
QCheckBox
- 鼠标点击后判断条件不满足时,更改为未勾选状态。使用 clicked 事件,stateChanged 无法实现
QLayout
- 布局当做列表使用
- 添加item .addWidget(w) 或者 .insertWidget(index, w)
- 移除item .itemAt(i).widget().deleteLater() 或 .removeWidget(item)
- 获取item .itemAt(index).widget()
- item个数 .count()