本文整理匯總了Python中qgis.PyQt.QtCore.QSize方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QSize方法的具體用法?Python QtCore.QSize怎麽用?Python QtCore.QSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qgis.PyQt.QtCore
的用法示例。
在下文中一共展示了QtCore.QSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: validate
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import QSize [as 別名]
def validate(self):
"""
Verifies contents displayed on mapping table in order to infer its validity
as datasource conversion map.
:return: (bool) map validity status.
"""
# validate map
msg = self.invalidatedReason()
if msg:
# if an invalidation reason was given, warn user and nothing else.
msgBar = QgsMessageBar(self)
# if window is resized, msgBar stays, not ideal, but works for now
# maybe we should connect to some parent resizing signal or something...
msgBar.resize(QSize(self.geometry().size().width(), msgBar.geometry().height()))
msgBar.pushMessage(self.tr('Warning!'), msg, level=Qgis.Warning, duration=5)
QgsMessageLog.logMessage(msg, 'DSGTools Plugin', Qgis.Critical)
return msg == ''
示例2: __init__
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import QSize [as 別名]
def __init__(self, md, iface, parent):
super(AddMeasurePointWidget, self).__init__(parent)
self.setupUi(self)
self.measureDialog = md
self.iface = iface
self.canvas = iface.mapCanvas()
self.xymenu = QMenu()
icon = QIcon(os.path.dirname(__file__) + '/images/yx.png')
a = self.xymenu.addAction(icon, "Y, X (Lat, Lon) Order")
a.setData(0)
icon = QIcon(os.path.dirname(__file__) + '/images/xy.png')
a = self.xymenu.addAction(icon, "X, Y (Lon, Lat) Order")
a.setData(1)
self.xyButton.setIconSize(QSize(24, 24))
self.xyButton.setIcon(icon)
self.xyButton.setMenu(self.xymenu)
self.xyButton.triggered.connect(self.xyTriggered)
self.crsmenu = QMenu()
icon = QIcon(os.path.dirname(__file__) + '/images/wgs84Projection.png')
a = self.crsmenu.addAction(icon, "WGS 84 (latitude & longitude)")
a.setData(0)
icon = QIcon(os.path.dirname(__file__) + '/images/projProjection.png')
a = self.crsmenu.addAction(icon, "Project CRS")
a.setData(1)
icon = QIcon(os.path.dirname(__file__) + '/images/customProjection.png')
a = self.crsmenu.addAction(icon, "Specify CRS")
a.setData(2)
self.crsButton.setIconSize(QSize(24, 24))
self.crsButton.setIcon(icon)
self.crsButton.setMenu(self.crsmenu)
self.crsButton.triggered.connect(self.crsTriggered)
self.addButton.clicked.connect(self.addPoint)
self.exitButton.clicked.connect(self.closeDialog)
self.readSettings()
self.configButtons()
self.restoreGeometry(QSettings().value("ShapeTools/AddMeasurePointGeometry", QByteArray(), type=QByteArray))
示例3: __init__
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import QSize [as 別名]
def __init__(self, lltools, iface, parent):
super(DigitizerWidget, self).__init__(parent)
self.setupUi(self)
self.lltools = lltools
self.iface = iface
self.canvas = iface.mapCanvas()
self.xymenu = QMenu()
icon = QIcon(os.path.dirname(__file__) + '/images/yx.png')
a = self.xymenu.addAction(icon, "Y, X (Lat, Lon) Order")
a.setData(0)
icon = QIcon(os.path.dirname(__file__) + '/images/xy.png')
a = self.xymenu.addAction(icon, "X, Y (Lon, Lat) Order")
a.setData(1)
self.xyButton.setIconSize(QSize(24, 24))
self.xyButton.setIcon(icon)
self.xyButton.setMenu(self.xymenu)
self.xyButton.triggered.connect(self.xyTriggered)
self.crsmenu = QMenu()
icon = QIcon(os.path.dirname(__file__) + '/images/wgs84Projection.png')
a = self.crsmenu.addAction(icon, "WGS 84 (latitude & longitude)")
a.setData(0)
icon = QIcon(os.path.dirname(__file__) + '/images/mgrsProjection.png')
a = self.crsmenu.addAction(icon, "MGRS")
a.setData(1)
icon = QIcon(os.path.dirname(__file__) + '/images/projProjection.png')
a = self.crsmenu.addAction(icon, "Project CRS")
a.setData(2)
icon = QIcon(os.path.dirname(__file__) + '/images/customProjection.png')
a = self.crsmenu.addAction(icon, "Specify CRS")
a.setData(3)
icon = QIcon(os.path.dirname(__file__) + '/images/pluscodes.png')
a = self.crsmenu.addAction(icon, "Plus Codes")
a.setData(4)
icon = QIcon(os.path.dirname(__file__) + '/images/utm.png')
a = self.crsmenu.addAction(icon, "UTM")
a.setData(5)
self.crsButton.setIconSize(QSize(24, 24))
self.crsButton.setIcon(icon)
self.crsButton.setMenu(self.crsmenu)
self.crsButton.triggered.connect(self.crsTriggered)
self.iface.currentLayerChanged.connect(self.currentLayerChanged)
self.addButton.clicked.connect(self.addFeature)
self.exitButton.clicked.connect(self.exit)
self.readSettings()
self.configButtons()
示例4: get_qgis_app
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import QSize [as 別名]
def get_qgis_app():
""" Start one QGIS application to test against.
:returns: Handle to QGIS app, canvas, iface and parent. If there are any
errors the tuple members will be returned as None.
:rtype: (QgsApplication, CANVAS, IFACE, PARENT)
If QGIS is already running the handle to that app will be returned.
"""
try:
from qgis.PyQt import QtGui, QtCore
from qgis.core import QgsApplication
from qgis.gui import QgsMapCanvas
from .qgis_interface import QgisInterface
except ImportError:
return None, None, None, None
global QGIS_APP # pylint: disable=W0603
if QGIS_APP is None:
gui_flag = True # All test will run qgis in gui mode
#noinspection PyPep8Naming
QGIS_APP = QgsApplication(sys.argv, gui_flag)
# Make sure QGIS_PREFIX_PATH is set in your env if needed!
QGIS_APP.initQgis()
s = QGIS_APP.showSettings()
LOGGER.debug(s)
global PARENT # pylint: disable=W0603
if PARENT is None:
#noinspection PyPep8Naming
PARENT = QtGui.QWidget()
global CANVAS # pylint: disable=W0603
if CANVAS is None:
#noinspection PyPep8Naming
CANVAS = QgsMapCanvas(PARENT)
CANVAS.resize(QtCore.QSize(400, 400))
global IFACE # pylint: disable=W0603
if IFACE is None:
# QgisInterface is a stub implementation of the QGIS plugin interface
#noinspection PyPep8Naming
IFACE = QgisInterface(CANVAS)
return QGIS_APP, CANVAS, IFACE, PARENT
示例5: drawMagnifierOnVideo
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import QSize [as 別名]
def drawMagnifierOnVideo(widget, dragPos, source, painter):
''' Draw Magnifier on Video '''
oldTransform = painter.transform()
painter.setTransform(oldTransform)
painter.setBrush(DrawToolBar.transparent_brush)
dim = min(widget.width(), widget.height())
magnifierSize = min(MAX_MAGNIFIER, dim * 2 / 3)
radius = magnifierSize / 2
ring = radius - 15
box = QSize(magnifierSize, magnifierSize)
center = dragPos - QPoint(0, radius)
center += QPoint(0, radius / 2)
corner = center - QPoint(radius, radius)
xy = center * MAX_FACTOR - QPoint(radius, radius)
# only set the dimension to the magnified portion
zoomPixmap = QPixmap(box)
zoomPixmap.fill(Qt.black)
painter_p = QPainter(zoomPixmap)
painter_p.setRenderHint(QPainter.HighQualityAntialiasing)
painter_p.translate(-xy)
painter_p.scale(MAX_FACTOR, MAX_FACTOR)
painter_p.drawImage(widget.surface.videoRect(), source, widget.surface.sourceRect())
painter_p.end()
clipPath = QPainterPath()
center = QPointF(center)
# Shape Type
if TYPE_MAGNIFIER == 0:
# Square
clipPath.addRect(center.x(), center.y(), magnifierSize, magnifierSize)
clipPath.translate(-radius, -radius)
else:
# Circle
clipPath.addEllipse(center, ring, ring)
painter.setClipPath(clipPath)
painter.drawPixmap(corner, zoomPixmap)
painter.setPen(DrawToolBar.glass_pen)
painter.drawPath(clipPath)
return