本文整理汇总了Python中qgis.PyQt.QtWidgets.QAction.setFont方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setFont方法的具体用法?Python QAction.setFont怎么用?Python QAction.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.PyQt.QtWidgets.QAction
的用法示例。
在下文中一共展示了QAction.setFont方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addInfoActions
# 需要导入模块: from qgis.PyQt.QtWidgets import QAction [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QAction import setFont [as 别名]
def addInfoActions(layer):
commitId = getCommitId(layer)
tracking = getTrackingInfo(layer)
repo = Repository(tracking.repoUrl)
_infoActions[layer.id()] = []
try:
commit = Commit.fromref(repo, commitId)
messageAction = QAction("Message: '%s'" % commit.message.splitlines()[0], config.iface.legendInterface())
f = messageAction.font();
f.setBold(True);
messageAction.setFont(f);
config.iface.legendInterface().addLegendLayerAction(messageAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
_infoActions[layer.id()].append(messageAction)
except Exception, e:
QgsMessageLog.logMessage("Cannot connect to server when creating GeoGig layer context:\n %s" % str(e), level=QgsMessageLog.WARNING)
messageAction = QAction("Error: Cannot connect with repository", config.iface.legendInterface())
f = messageAction.font();
f.setBold(True);
messageAction.setFont(f);
config.iface.legendInterface().addLegendLayerAction(messageAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
_infoActions[layer.id()].append(messageAction)
return False
示例2: str
# 需要导入模块: from qgis.PyQt.QtWidgets import QAction [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QAction import setFont [as 别名]
config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
_infoActions[layer.id()].append(messageAction)
except Exception, e:
QgsMessageLog.logMessage("Cannot connect to server when creating GeoGig layer context:\n %s" % str(e), level=QgsMessageLog.WARNING)
messageAction = QAction("Error: Cannot connect with repository", config.iface.legendInterface())
f = messageAction.font();
f.setBold(True);
messageAction.setFont(f);
config.iface.legendInterface().addLegendLayerAction(messageAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
_infoActions[layer.id()].append(messageAction)
return False
shaAction = QAction("Commit ID: %s" % commitId, config.iface.legendInterface())
f = shaAction.font();
f.setBold(True);
shaAction.setFont(f);
config.iface.legendInterface().addLegendLayerAction(shaAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
config.iface.legendInterface().addLegendLayerActionForLayer(shaAction, layer)
_infoActions[layer.id()].append(shaAction)
return True
def updateInfoActions(layer):
setAsRepoLayer(layer)
def setAsNonRepoLayer(layer):
removeLayerActions(layer)
action = QAction("Import to GeoGig...", config.iface.legendInterface())
action.triggered.connect(partial(addLayer, layer))
if layer.type() == QgsMapLayer.RasterLayer or layer.storageType() != 'GPKG':
action.setEnabled(False)
config.iface.legendInterface().addLegendLayerAction(action, u"GeoGig", u"id2", QgsMapLayer.VectorLayer, False)