本文整理汇总了Python中AnyQt.QtWidgets.QComboBox.row方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.row方法的具体用法?Python QComboBox.row怎么用?Python QComboBox.row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QComboBox
的用法示例。
在下文中一共展示了QComboBox.row方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_row
# 需要导入模块: from AnyQt.QtWidgets import QComboBox [as 别名]
# 或者: from AnyQt.QtWidgets.QComboBox import row [as 别名]
def add_row(self, attr=None, condition_type=None, condition_value=None):
model = self.cond_list.model()
row = model.rowCount()
model.insertRow(row)
attr_combo = QComboBox(
minimumContentsLength=12,
sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLengthWithIcon)
attr_combo.row = row
for var in self._visible_variables(self.data.domain):
attr_combo.addItem(*gui.attributeItem(var))
attr_combo.setCurrentIndex(attr or 0)
self.cond_list.setCellWidget(row, 0, attr_combo)
index = QPersistentModelIndex(model.index(row, 3))
temp_button = QPushButton('×', self, flat=True,
styleSheet='* {font-size: 16pt; color: silver}'
'*:hover {color: black}')
temp_button.clicked.connect(lambda: self.remove_one(index.row()))
self.cond_list.setCellWidget(row, 3, temp_button)
self.remove_all_button.setDisabled(False)
self.set_new_operators(attr_combo, attr is not None,
condition_type, condition_value)
attr_combo.currentIndexChanged.connect(
lambda _: self.set_new_operators(attr_combo, False))
self.cond_list.resizeRowToContents(row)
示例2: set_new_operators
# 需要导入模块: from AnyQt.QtWidgets import QComboBox [as 别名]
# 或者: from AnyQt.QtWidgets.QComboBox import row [as 别名]
def set_new_operators(self, attr_combo, adding_all,
selected_index=None, selected_values=None):
oper_combo = QComboBox()
oper_combo.row = attr_combo.row
oper_combo.attr_combo = attr_combo
var = self.data.domain[attr_combo.currentText()]
oper_combo.addItems(self.operator_names[type(var)])
oper_combo.setCurrentIndex(selected_index or 0)
self.cond_list.setCellWidget(oper_combo.row, 1, oper_combo)
self.set_new_values(oper_combo, adding_all, selected_values)
oper_combo.currentIndexChanged.connect(
lambda _: self.set_new_values(oper_combo, False))