本文整理汇总了Python中PyQt5.QtGui.QStandardItem.setTextAlignment方法的典型用法代码示例。如果您正苦于以下问题:Python QStandardItem.setTextAlignment方法的具体用法?Python QStandardItem.setTextAlignment怎么用?Python QStandardItem.setTextAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QStandardItem
的用法示例。
在下文中一共展示了QStandardItem.setTextAlignment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: localAdd
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setTextAlignment [as 别名]
def localAdd(self, path,iso):
# Add an entry in local ISOs list, with indications about checking
itemPath=QStandardItem(path)
itemIso=QStandardItem(iso)
itemCompletion=QStandardItem("0%")
itemCompletion.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
itemDate=QStandardItem("--/--/--")
itemDate.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
itemCheck1=QStandardItem("--")
itemCheck1.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
itemCheck5=QStandardItem("--")
itemCheck5.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
self.model.appendRow([itemPath,itemIso,itemCompletion,itemDate, itemCheck1, itemCheck5,])
self.localListNames.append([path,iso])
示例2: localAdd
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setTextAlignment [as 别名]
def localAdd(self, path,iso,isoSize):
# Add an entry in local ISOs list, with indications about checking
itemPath=QStandardItem(path)
itemIso=QStandardItem(iso)
if isoSize==0:
itemSize=QStandardItem('--')
else:
formatedSize='{:n}'.format(isoSize).replace(","," ")
itemSize=QStandardItem(formatedSize)
itemSize.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
itemDate=QStandardItem("--/--/--")
itemDate.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
itemCheck1=QStandardItem("--")
itemCheck1.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
itemCheck5=QStandardItem("--")
itemCheck5.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter)
self.model.appendRow([itemPath,itemIso,itemSize,itemDate, itemCheck1, itemCheck5,])
self.localListNames.append([path,iso])
示例3: populate
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setTextAlignment [as 别名]
def populate(self):
"""Populate the tree view with data from the installed extensions.
"""
# TODO/Question:
# Would it make sense to move this to a dedicated model class
# complementing the FailedModel?
root = self.tree.model().invisibleRootItem()
extensions = app.extensions()
for ext in extensions.installed_extensions():
ext_infos = extensions.infos(ext)
display_name = ext_infos.get(ext, ext) if ext_infos else ext.name()
loaded_extension = extensions.get(ext)
if loaded_extension:
display_name += ' ({})'.format(loaded_extension.load_time())
name_item = QStandardItem(display_name)
name_item.extension_name = ext
name_item.setCheckable(True)
self.name_items[ext] = name_item
icon = extensions.icon(ext)
if icon:
name_item.setIcon(icon)
root.appendRow([name_item])
for entry in [
'extension-name',
'short-description',
'description',
'version',
'api-version',
'dependencies',
'maintainers',
'repository',
'website',
'license'
]:
label_item = QStandardItem('{}:'.format(
self.config_labels[entry]))
label_item.setTextAlignment(Qt.AlignTop)
bold = QFont()
bold.setWeight(QFont.Bold)
label_item.setFont(bold)
details = ext_infos.get(entry, "") if ext_infos else ""
if type(details) == list:
details = '\n'.join(details)
details_item = QStandardItem(details)
details_item.setTextAlignment(Qt.AlignTop)
if entry == 'api-version':
# Check for correct(ly formatted) api-version entry
# and highlight it in case of mismatch
api_version = appinfo.extension_api
if not details:
details_item.setFont(bold)
details_item.setText(
_("Misformat: {api}").format(details))
elif not details == api_version:
details_item.setFont(bold)
details_item.setText('{} ({}: {})'.format(
details,
appinfo.appname,
api_version))
name_item.appendRow([label_item, details_item])