本文整理汇总了Python中PyQt5.Qt.QAbstractListModel类的典型用法代码示例。如果您正苦于以下问题:Python QAbstractListModel类的具体用法?Python QAbstractListModel怎么用?Python QAbstractListModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QAbstractListModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, db, parent=None, pref_name=None):
self.pref_name = pref_name or 'book_display_fields'
QAbstractListModel.__init__(self, parent)
self.fields = []
self.db = db
self.changed = False
示例2: __init__
def __init__(self, prefs, fm, pref_name, parent=None):
QAbstractListModel.__init__(self, parent)
self.fm = fm
self.pref_name = pref_name
if pref_name == 'column_color_rules':
self.rule_kind = 'color'
rules = list(prefs[pref_name])
self.rules = []
for col, template in rules:
if col not in self.fm and col != color_row_key:
continue
try:
rule = rule_from_template(self.fm, template)
except:
rule = template
self.rules.append(('color', col, rule))
else:
self.rule_kind = 'icon' if pref_name == 'column_icon_rules' else 'emblem'
rules = list(prefs[pref_name])
self.rules = []
for kind, col, template in rules:
if col not in self.fm and col != color_row_key:
continue
try:
rule = rule_from_template(self.fm, template)
except:
rule = template
self.rules.append((kind, col, rule))
示例3: __init__
def __init__(self, current_cover, parent=None):
QAbstractListModel.__init__(self, parent)
if current_cover is None:
current_cover = QPixmap(I("default_cover.png"))
self.blank = QPixmap(I("blank.png")).scaled(150, 200)
self.cc = current_cover
self.reset_covers(do_reset=False)
示例4: __init__
def __init__(self, shortcuts, config_file_base_name, parent=None):
QAbstractListModel.__init__(self, parent)
self.descriptions = {}
for k, v in shortcuts.items():
self.descriptions[k] = v[-1]
self.keys = {}
for k, v in shortcuts.items():
self.keys[k] = v[0]
self.order = list(shortcuts)
self.order.sort(key=lambda x: sort_key(self.descriptions[x]))
self.sequences = {}
for k, v in self.keys.items():
self.sequences[k] = [QKeySequence(x) for x in v]
self.custom = XMLConfig(config_file_base_name)
示例5: __init__
def __init__(self, prefs, fm, pref_name, parent=None):
QAbstractListModel.__init__(self, parent)
self.fm = fm
self.pref_name = pref_name
if pref_name == 'column_color_rules':
self.rule_kind = 'color'
rules = list(prefs[pref_name])
self.rules = []
for col, template in rules:
rule = self.load_rule(col, template)
if rule is not None:
self.rules.append(('color', col, rule))
else:
self.rule_kind = 'icon' if pref_name == 'column_icon_rules' else 'emblem'
rules = list(prefs[pref_name])
self.rules = []
for kind, col, template in rules:
rule = self.load_rule(col, template)
if rule is not None:
self.rules.append((kind, col, rule))
示例6: __init__
def __init__(self, parent):
QAbstractListModel.__init__(self, parent)
self.icon_size = parent.iconSize()
self.build()
示例7: __init__
def __init__(self, recipe_model):
QAbstractListModel.__init__(self)
self.recipe_model = recipe_model
示例8: __init__
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
self.chars = []
self.allow_dnd = False
示例9: __init__
def __init__(self, db, parent=None):
self.keys = sorted(db, key=lambda x: x.lower())
QAbstractListModel.__init__(self, parent)
示例10: flags
def flags(self, index):
ans = QAbstractListModel.flags(self, index)
return ans | Qt.ItemIsUserCheckable
示例11: __init__
def __init__(self, widgets):
self.widgets = widgets
QAbstractListModel.__init__(self)
示例12: flags
def flags(self, index):
if not index.isValid():
return Qt.ItemIsEnabled
return QAbstractListModel.flags(self, index) | Qt.ItemIsEditable
示例13: __init__
def __init__(self, manufacturer):
QAbstractListModel.__init__(self)
self.devices = get_devices_of(manufacturer)
示例14: __init__
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
SearchQueryParser.__init__(self, ['all'])
self.parse_tweaks()
示例15: __init__
def __init__(self, parent=None, sort_func=sort_key):
QAbstractListModel.__init__(self, parent)
self.sort_func = sort_func
self.all_items = self.current_items = ()
self.current_prefix = ''