def _create_fontcombobox(self, name): """Return a combobox for modifying a multiple-getValue setting.""" setting = self.settingItems[name] # Create the combobox and populate it combo = QFontComboBox() combo.setMinimumWidth(100) combo.setMaximumWidth(150) combo.setFontFilters(QFontComboBox.AllFonts) # 设置过滤器 # Ugly event handler! def combo_changed(index): self._changedSettings[name] = combo.currentFont().family() combo.currentFontChanged.connect(combo_changed) # Set the initial getValue, if any def combo_update(value): combo.setCurrentFont(QFont(value)) self._updateActions[name] = combo_update # combo_update(self.currentSettings.get(name, list(SettingEnums.enums[valuetype].values())[0])) return combo