本文整理汇总了Python中AnyQt.QtCore.QUrl.resolved方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.resolved方法的具体用法?Python QUrl.resolved怎么用?Python QUrl.resolved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtCore.QUrl
的用法示例。
在下文中一共展示了QUrl.resolved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: url_from_value
# 需要导入模块: from AnyQt.QtCore import QUrl [as 别名]
# 或者: from AnyQt.QtCore.QUrl import resolved [as 别名]
def url_from_value(self, value):
base = value.variable.attributes.get("origin", "")
if QDir(base).exists():
base = QUrl.fromLocalFile(base)
else:
base = QUrl(base)
path = base.path()
if path.strip() and not path.endswith("/"):
base.setPath(path + "/")
url = base.resolved(QUrl(str(value)))
return url
示例2: urlFromValue
# 需要导入模块: from AnyQt.QtCore import QUrl [as 别名]
# 或者: from AnyQt.QtCore.QUrl import resolved [as 别名]
def urlFromValue(self, value):
variable = value.variable
origin = variable.attributes.get("origin", "")
if origin and QDir(origin).exists():
origin = QUrl.fromLocalFile(origin)
elif origin:
origin = QUrl(origin)
if not origin.scheme():
origin.setScheme("file")
else:
origin = QUrl("")
base = origin.path()
if base.strip() and not base.endswith("/"):
origin.setPath(base + "/")
name = QUrl(str(value))
url = origin.resolved(name)
if not url.scheme():
url.setScheme("file")
return url