本文整理汇总了Python中qgis.PyQt.QtGui.QCursor类的典型用法代码示例。如果您正苦于以下问题:Python QCursor类的具体用法?Python QCursor怎么用?Python QCursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QCursor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: selectExtent
def selectExtent(self):
popupmenu = QMenu()
useCanvasExtentAction = QAction(
QCoreApplication.translate("ExtentSelectionPanel", 'Use Canvas Extent'),
self.btnSelect)
useLayerExtentAction = QAction(
QCoreApplication.translate("ExtentSelectionPanel", 'Use Layer Extent…'),
self.btnSelect)
selectOnCanvasAction = QAction(
self.tr('Select Extent on Canvas'), self.btnSelect)
popupmenu.addAction(useCanvasExtentAction)
popupmenu.addAction(selectOnCanvasAction)
popupmenu.addSeparator()
popupmenu.addAction(useLayerExtentAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
useCanvasExtentAction.triggered.connect(self.useCanvasExtent)
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
useMincoveringExtentAction = QAction(
self.tr('Use Min Covering Extent from Input Layers'),
self.btnSelect)
useMincoveringExtentAction.triggered.connect(
self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QCursor.pos())
示例2: showSnippets
def showSnippets(self, evt):
popupmenu = QMenu()
for name, snippet in list(self.snippets.items()):
action = QAction(self.tr(name), self.btnSnippets)
action.triggered[()].connect(lambda snippet=snippet: self.editor.insert(snippet))
popupmenu.addAction(action)
popupmenu.exec_(QCursor.pos())
示例3: showPopupMenu
def showPopupMenu(self):
popup_menu = QMenu()
select_all_action = QAction(self.tr('Select All'), popup_menu)
select_all_action.triggered.connect(self.selectAll)
clear_all_action = QAction(self.tr('Clear Selection'), popup_menu)
clear_all_action.triggered.connect(self.deselectAll)
popup_menu.addAction(select_all_action)
popup_menu.addAction(clear_all_action)
popup_menu.exec_(QCursor.pos())
示例4: context_menu
def context_menu(self):
"""Add context menu fonctions."""
menu = QMenu(self.dlg.layoutList)
menu.addAction(self.tr(u'Check...'), self.actionCheckLayout)
menu.addAction(self.tr(u'Uncheck...'), self.actionUncheckLayout)
menu.addSeparator()
menu.addAction(self.tr(u'Show...'), self.actionShowLayout)
menu.addAction(self.tr(u'Close...'), self.actionHideLayout)
menu.exec_(QCursor.pos())
示例5: showPopupMenu
def showPopupMenu(self):
popupmenu = QMenu()
if not (isinstance(self.param, ParameterMultipleInput) and self.param.datatype == dataobjects.TYPE_FILE):
selectLayerAction = QAction(self.tr("Select from open layers"), self.pushButton)
selectLayerAction.triggered.connect(self.showLayerSelectionDialog)
popupmenu.addAction(selectLayerAction)
selectFileAction = QAction(self.tr("Select from filesystem"), self.pushButton)
selectFileAction.triggered.connect(self.showFileSelectionDialog)
popupmenu.addAction(selectFileAction)
popupmenu.exec_(QCursor.pos())
示例6: selectOutput
def selectOutput(self):
if isinstance(self.parameter, QgsProcessingParameterFolderDestination):
self.selectDirectory()
else:
popupMenu = QMenu()
if not self.default_selection:
if self.parameter.flags() & QgsProcessingParameterDefinition.FlagOptional:
actionSkipOutput = QAction(
self.tr('Skip Output'), self.btnSelect)
actionSkipOutput.triggered.connect(self.skipOutput)
popupMenu.addAction(actionSkipOutput)
if isinstance(self.parameter, QgsProcessingParameterFeatureSink) \
and self.parameter.supportsNonFileBasedOutput():
# use memory layers for temporary layers if supported
actionSaveToTemp = QAction(
self.tr('Create Temporary Layer'), self.btnSelect)
else:
actionSaveToTemp = QAction(
self.tr('Save to a Temporary File'), self.btnSelect)
actionSaveToTemp.triggered.connect(self.saveToTemporary)
popupMenu.addAction(actionSaveToTemp)
actionSaveToFile = QAction(
QCoreApplication.translate('DestinationSelectionPanel', 'Save to File…'), self.btnSelect)
actionSaveToFile.triggered.connect(self.selectFile)
popupMenu.addAction(actionSaveToFile)
if isinstance(self.parameter, QgsProcessingParameterFeatureSink) \
and self.parameter.supportsNonFileBasedOutput():
actionSaveToGpkg = QAction(
QCoreApplication.translate('DestinationSelectionPanel', 'Save to GeoPackage…'), self.btnSelect)
actionSaveToGpkg.triggered.connect(self.saveToGeopackage)
popupMenu.addAction(actionSaveToGpkg)
actionSaveToPostGIS = QAction(
QCoreApplication.translate('DestinationSelectionPanel', 'Save to PostGIS Table…'), self.btnSelect)
actionSaveToPostGIS.triggered.connect(self.saveToPostGIS)
settings = QgsSettings()
settings.beginGroup('/PostgreSQL/connections/')
names = settings.childGroups()
settings.endGroup()
actionSaveToPostGIS.setEnabled(bool(names))
popupMenu.addAction(actionSaveToPostGIS)
actionSetEncoding = QAction(
QCoreApplication.translate('DestinationSelectionPanel', 'Change File Encoding ({})…').format(self.encoding), self.btnSelect)
actionSetEncoding.triggered.connect(self.selectEncoding)
popupMenu.addAction(actionSetEncoding)
popupMenu.exec_(QCursor.pos())
示例7: selectOutput
def selectOutput(self):
if isinstance(self.parameter, QgsProcessingParameterFolderDestination):
self.selectDirectory()
else:
popupMenu = QMenu()
if self.parameter.flags() & QgsProcessingParameterDefinition.FlagOptional:
actionSkipOutput = QAction(
self.tr('Skip output'), self.btnSelect)
actionSkipOutput.triggered.connect(self.skipOutput)
popupMenu.addAction(actionSkipOutput)
if isinstance(self.parameter, QgsProcessingParameterFeatureSink) \
and self.alg.provider().supportsNonFileBasedOutput():
# use memory layers for temporary layers if supported
actionSaveToTemp = QAction(
self.tr('Create temporary layer'), self.btnSelect)
else:
actionSaveToTemp = QAction(
self.tr('Save to a temporary file'), self.btnSelect)
actionSaveToTemp.triggered.connect(self.saveToTemporary)
popupMenu.addAction(actionSaveToTemp)
actionSaveToFile = QAction(
self.tr('Save to file...'), self.btnSelect)
actionSaveToFile.triggered.connect(self.selectFile)
popupMenu.addAction(actionSaveToFile)
actionShowExpressionsBuilder = QAction(
self.tr('Use expression...'), self.btnSelect)
actionShowExpressionsBuilder.triggered.connect(self.showExpressionsBuilder)
popupMenu.addAction(actionShowExpressionsBuilder)
if isinstance(self.parameter, QgsProcessingParameterFeatureSink) \
and self.alg.provider().supportsNonFileBasedOutput():
actionSaveToSpatialite = QAction(
self.tr('Save to SpatiaLite table...'), self.btnSelect)
actionSaveToSpatialite.triggered.connect(self.saveToSpatialite)
popupMenu.addAction(actionSaveToSpatialite)
actionSaveToPostGIS = QAction(
self.tr('Save to PostGIS table...'), self.btnSelect)
actionSaveToPostGIS.triggered.connect(self.saveToPostGIS)
settings = QgsSettings()
settings.beginGroup('/PostgreSQL/connections/')
names = settings.childGroups()
settings.endGroup()
actionSaveToPostGIS.setEnabled(bool(names))
popupMenu.addAction(actionSaveToPostGIS)
popupMenu.exec_(QCursor.pos())
示例8: selectExtent
def selectExtent(self):
popupmenu = QMenu()
useLayerExtentAction = QAction(
self.tr('Use layer/canvas extent'), self.btnSelect)
selectOnCanvasAction = QAction(
self.tr('Select extent on canvas'), self.btnSelect)
popupmenu.addAction(useLayerExtentAction)
popupmenu.addAction(selectOnCanvasAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
popupmenu.exec_(QCursor.pos())
示例9: showPopupMenu
def showPopupMenu(self):
popupmenu = QMenu()
if (isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() != QgsProcessing.TypeFile):
selectLayerAction = QAction(self.tr('Select from Open Layers…'), self.pushButton)
selectLayerAction.triggered.connect(self.showLayerSelectionDialog)
popupmenu.addAction(selectLayerAction)
selectFileAction = QAction(self.tr('Select from File System…'), self.pushButton)
selectFileAction.triggered.connect(self.showFileSelectionDialog)
popupmenu.addAction(selectFileAction)
popupmenu.exec_(QCursor.pos())
示例10: showPopupMenu
def showPopupMenu(self):
popupmenu = QMenu()
if not (isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType == dataobjects.TYPE_FILE):
selectLayerAction = QAction(
QCoreApplication.translate('BatchInputSelectionPanel', 'Select from Open Layers…'), self.pushButton)
selectLayerAction.triggered.connect(self.showLayerSelectionDialog)
popupmenu.addAction(selectLayerAction)
selectFileAction = QAction(
QCoreApplication.translate('BatchInputSelectionPanel', 'Select from File System…'), self.pushButton)
selectFileAction.triggered.connect(self.showFileSelectionDialog)
popupmenu.addAction(selectFileAction)
popupmenu.exec_(QCursor.pos())
示例11: selectExtent
def selectExtent(self):
popupmenu = QMenu()
useLayerExtentAction = QAction(self.tr("Use layer/canvas extent"), self.btnSelect)
selectOnCanvasAction = QAction(self.tr("Select extent on canvas"), self.btnSelect)
popupmenu.addAction(useLayerExtentAction)
popupmenu.addAction(selectOnCanvasAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
if self.canUseAutoExtent():
useMincoveringExtentAction = QAction(self.tr("Use min covering extent from input layers"), self.btnSelect)
useMincoveringExtentAction.triggered.connect(self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QCursor.pos())
示例12: selectOutput
def selectOutput(self):
if isinstance(self.output, OutputDirectory):
self.selectDirectory()
else:
popupMenu = QMenu()
if isinstance(self.output, OutputVector) \
and self.alg.provider.supportsNonFileBasedOutput():
# use memory layers for temporary layers if supported
actionSaveToTemp = QAction(
self.tr('Create temporary layer'), self.btnSelect)
else:
actionSaveToTemp = QAction(
self.tr('Save to a temporary file'), self.btnSelect)
actionSaveToTemp.triggered.connect(self.saveToTemporary)
popupMenu.addAction(actionSaveToTemp)
actionSaveToFile = QAction(
self.tr('Save to file...'), self.btnSelect)
actionSaveToFile.triggered.connect(self.selectFile)
popupMenu.addAction(actionSaveToFile)
actionShowExpressionsBuilder = QAction(
self.tr('Use expression...'), self.btnSelect)
actionShowExpressionsBuilder.triggered.connect(self.showExpressionsBuilder)
popupMenu.addAction(actionShowExpressionsBuilder)
if isinstance(self.output, OutputVector) \
and self.alg.provider.supportsNonFileBasedOutput():
actionSaveToSpatialite = QAction(
self.tr('Save to Spatialite table...'), self.btnSelect)
actionSaveToSpatialite.triggered.connect(self.saveToSpatialite)
popupMenu.addAction(actionSaveToSpatialite)
actionSaveToPostGIS = QAction(
self.tr('Save to PostGIS table...'), self.btnSelect)
actionSaveToPostGIS.triggered.connect(self.saveToPostGIS)
settings = QSettings()
settings.beginGroup('/PostgreSQL/connections/')
names = settings.childGroups()
settings.endGroup()
actionSaveToPostGIS.setEnabled(bool(names))
popupMenu.addAction(actionSaveToPostGIS)
popupMenu.exec_(QCursor.pos())