当前位置: 首页>>代码示例>>Python>>正文


Python QgsLayoutItemLabel.setVAlign方法代码示例

本文整理汇总了Python中qgis.core.QgsLayoutItemLabel.setVAlign方法的典型用法代码示例。如果您正苦于以下问题:Python QgsLayoutItemLabel.setVAlign方法的具体用法?Python QgsLayoutItemLabel.setVAlign怎么用?Python QgsLayoutItemLabel.setVAlign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.core.QgsLayoutItemLabel的用法示例。


在下文中一共展示了QgsLayoutItemLabel.setVAlign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: buildComposerLabel

# 需要导入模块: from qgis.core import QgsLayoutItemLabel [as 别名]
# 或者: from qgis.core.QgsLayoutItemLabel import setVAlign [as 别名]
    def buildComposerLabel(self, key, item, page):
        '''
        Add a label to the print layout for an item and page
        '''
        cl = QgsLayoutItemLabel(self.currentComposition)

        # 1st page is a map for parcelle
        dpage = page -1
        if self.etype == 'parcelle' and self.print_parcelle_page:
            dpage = page

        cl.attemptMove(
            QgsLayoutPoint(
                item['position'][0],
                item['position'][1]+ (dpage) * (self.pageHeight + 10),
                QgsUnitTypes.LayoutMillimeters
            )
        )
        cl.setFixedSize(
            QgsLayoutSize(
                item['position'][2],
                item['position'][3],
                QgsUnitTypes.LayoutMillimeters
            )
        )

        cl.setVAlign(item['align'][0])
        cl.setHAlign(item['align'][1])
        content = self.getContentForGivenItem(
            key,
            item,
            page
        )

        cl.setMargin(0)
        cl.setMode(1)
        cl.setText(content)
        cl.setFrameEnabled(False)
        if 'bgcolor' in item:
            cl.setBackgroundColor(item['bgcolor'])
        if 'htmlState' in item:
            cl.setMode(item['htmlState'])
        if 'font' in item:
            cl.setFont(item['font'])

        self.currentComposition.addLayoutItem(cl)
开发者ID:rldhont,项目名称:QgisCadastrePlugin,代码行数:48,代码来源:cadastre_export.py


注:本文中的qgis.core.QgsLayoutItemLabel.setVAlign方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。