if __name__ == "__main__": from qgis.core.contextmanagers import qgisapp import qgis.PyQt.QtWidgets as qtWdg import qgis.gui as qgGui from moduls.QvLlegenda import QvLlegenda from moduls.QvAtributs import QvAtributs with qgisapp(sysexit=False) as app: QvApp().carregaIdioma(app, 'ca') canv = qgGui.QgsMapCanvas() atrib = QvAtributs(canv) leyenda = QvLlegenda(canv, atrib) leyenda.project.read('D:/qVista/EjemploSimbolos.qgs') canv.setWindowTitle('Canvas') canv.show() leyenda.setWindowTitle('Llegenda') leyenda.show() # Acciones personalizadas para menú contextual de la leyenda: # # - Definición de la acción y del metodo asociado # - Se añade la acción a la lista de acciones disponibles (llegenda.accions)
from qgis.gui import * from qgis.core.contextmanagers import qgisapp from qgis.PyQt.QtCore import * from qgis.PyQt.QtGui import * from qgis.PyQt.QtWidgets import QMainWindow, QDockWidget, QPushButton from moduls.QvLlegenda import QvLlegenda from moduls.QvAtributs import QvAtributs from moduls.QvCanvas import QvCanvas projecteInicial = 'MapesOffline/qVista default map.qgs' with qgisapp() as app: win = QMainWindow() # canvas = QvCanvas(llistaBotons=llistaBotons, posicioBotonera = 'SE', botoneraHoritzontal = True) canvas = QgsMapCanvas() win.setCentralWidget(canvas) project = QgsProject.instance() root = project.layerTreeRoot() bridge = QgsLayerTreeMapCanvasBridge(root, canvas) tablaAtributos = QvAtributs(canvas) # leyenda = QvLlegenda(canvas, tablaAtributos) boton = QPushButton('Botón de prueba') dw = QDockWidget("Dock Widget de prueba ", win) dw.setWidget(boton) win.addDockWidget(Qt.LeftDockWidgetArea, dw) win.show() project.read(projecteInicial)
if __name__ == "__main__": import qgis.gui as qgGui import qgis.PyQt.QtWidgets as qtWdg from qgis.core.contextmanagers import qgisapp from moduls.QvApp import QvApp from moduls.QvLlegenda import QvLlegenda from moduls.QvAtributs import QvAtributs with qgisapp(sysexit=False) as app: QvApp().carregaIdioma(app, 'ca') canvas = qgGui.QgsMapCanvas() atribs = QvAtributs(canvas) leyenda = QvLlegenda(canvas, atribs) leyenda.project.read('D:/qVista/EjemploMapTestMask.qgs') leyenda.mask = QvLlegendaMascara(leyenda, leyenda.capaPerNom("Màscara"), 1) leyenda.setMinimumSize(400, 500) leyenda.move(0, 0) leyenda.show() canvas.setWindowTitle('Test Mask Labels') canvas.setMinimumSize(1300, 900) canvas.move(leyenda.width() + 10, 0) canvas.show() # Acciones de prueba de máscara para etiquetas
from qgis.core import * from qgis.gui import * from qgis.core.contextmanagers import qgisapp from qgis.PyQt.QtCore import * from qgis.PyQt.QtGui import * from moduls.QvLlegenda import QvLlegenda from moduls.QvAtributs import QvAtributs # from moduls.QvCanvas import QvCanvas projecteInicial = 'MapesOffline/qVista default map.qgs' with qgisapp() as app: canvas = QgsMapCanvas() canvas.show() atributos = QvAtributs(canvas) proyecto = QgsProject.instance() root = proyecto.layerTreeRoot() bridge = QgsLayerTreeMapCanvasBridge(root, canvas) proyecto.read(projecteInicial) leyenda = QvLlegenda(canvas, atributos) leyenda.show()
from qgis.core.contextmanagers import qgisapp import qgis.gui as qgGui from moduls.QvLlegenda import QvLlegenda from moduls.QvAtributs import QvAtributs from moduls.QvApp import QvApp # from configuracioQvista import projecteInicial with qgisapp(sysexit=False) as app: QvApp().carregaIdioma(app, 'ca') canvas = qgGui.QgsMapCanvas() canvas.setWindowTitle('Mapa') atribs = QvAtributs(canvas) atribs.setWindowTitle('Taules') leyenda = QvLlegenda(canvas, atribs, editable=False) leyenda.project.read('D:/qVista/EjemploMapTestMask.qgs') leyenda.setWindowTitle('Llegenda') leyenda.move(0, 0) leyenda.show() canvas.move(leyenda.width(), 0) canvas.show() # Generación de botoneras de leyenda botonera = None clases = None