本文整理汇总了Python中PyQt4.QtCore.QStringList.prepend方法的典型用法代码示例。如果您正苦于以下问题:Python QStringList.prepend方法的具体用法?Python QStringList.prepend怎么用?Python QStringList.prepend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QStringList
的用法示例。
在下文中一共展示了QStringList.prepend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: path_from_index
# 需要导入模块: from PyQt4.QtCore import QStringList [as 别名]
# 或者: from PyQt4.QtCore.QStringList import prepend [as 别名]
def path_from_index(self, index):
""" Reimplemented. Finds part of a path given the index of
the last part required.
"""
data_list = QStringList()
while index.isValid():
data_list.prepend(self.model().data(index).toString())
index = index.parent()
ret = data_list.join("/")
print "path from index: %s" % (data_list.join(" :: "))
return ret
示例2: __qtReorderFilter
# 需要导入模块: from PyQt4.QtCore import QStringList [as 别名]
# 或者: from PyQt4.QtCore.QStringList import prepend [as 别名]
def __qtReorderFilter(filter, selectedFilter = None):
"""
Private function to reorder the file filter to cope with a KDE issue introduced
by distributors usage of KDE file dialogs.
@param filter Qt file filter (QString or string)
@param selectedFilter this is set to the selected filter (QString or string)
@return the rearranged Qt file filter (QString)
"""
if selectedFilter is not None and not Globals.isMacPlatform():
fileFilters = QStringList(filter.split(';;'))
## fileFilters.removeAll(selectedFilter)
fileFilters.prepend(selectedFilter)
return fileFilters.join(";;")
else:
return filter
示例3: __convertFilter
# 需要导入模块: from PyQt4.QtCore import QStringList [as 别名]
# 或者: from PyQt4.QtCore.QStringList import prepend [as 别名]
def __convertFilter(filter, selectedFilter = None):
"""
Private function to convert a Qt file filter to a KDE file filter.
@param filter Qt file filter (QString or string)
@param selectedFilter this is set to the selected filter
@return the corresponding KDE file filter (QString)
"""
rx = QRegExp("^[^(]*\(([^)]*)\).*$")
fileFilters = filter.split(';;')
newfilter = QStringList()
for fileFilter in fileFilters:
sf = selectedFilter and selectedFilter.compare(fileFilter) == 0
namefilter = QString(fileFilter).replace(rx, "\\1")
fileFilter = QString(fileFilter).replace('/', '\\/')
if sf:
newfilter.prepend("%s|%s" % (namefilter, fileFilter))
else:
newfilter.append("%s|%s" % (namefilter, fileFilter))
return newfilter.join('\n')