def test(): app = QApplication([]) app d = QDialog() d.setLayout(QVBoxLayout()) d.layout().addWidget(FontFamilyChooser(d)) d.layout().addWidget(QFontComboBox(d)) d.exec_()
def test(): from calibre.gui2 import Application app = Application([]) app d = QDialog() d.setLayout(QVBoxLayout()) d.layout().addWidget(FontFamilyChooser(d)) d.layout().addWidget(QFontComboBox(d)) d.exec()
EnComboBox.clear(self) def eventFilter(self, obj, e): try: c = self.lineEdit().mcompleter except AttributeError: return False etype = e.type() if self.eat_focus_out and self is obj and etype == QEvent.Type.FocusOut: if c.isVisible(): return True return EnComboBox.eventFilter(self, obj, e) if __name__ == '__main__': from qt.core import QDialog, QVBoxLayout from calibre.gui2 import Application app = Application([]) d = QDialog() d.setLayout(QVBoxLayout()) le = EditWithComplete(d) d.layout().addWidget(le) items = [ 'oane\n line2\n line3', 'otwo', 'othree', 'ooone', 'ootwo', 'other', 'odd', 'over', 'orc', 'oven', 'owe', 'oothree', 'a1', 'a2', 'Edgas', 'Èdgar', 'Édgaq', 'Edgar', 'Édgar' ] le.update_items_cache(items) le.show_initial_value('') d.exec()