本文整理匯總了Python中qgis.gui.QgsMapLayerComboBox.setSizeAdjustPolicy方法的典型用法代碼示例。如果您正苦於以下問題:Python QgsMapLayerComboBox.setSizeAdjustPolicy方法的具體用法?Python QgsMapLayerComboBox.setSizeAdjustPolicy怎麽用?Python QgsMapLayerComboBox.setSizeAdjustPolicy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qgis.gui.QgsMapLayerComboBox
的用法示例。
在下文中一共展示了QgsMapLayerComboBox.setSizeAdjustPolicy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Viewer
# 需要導入模塊: from qgis.gui import QgsMapLayerComboBox [as 別名]
# 或者: from qgis.gui.QgsMapLayerComboBox import setSizeAdjustPolicy [as 別名]
class Viewer(ViewerBase, ViewerClass):
trackingChanged = pyqtSignal(bool)
setLocationTriggered = pyqtSignal()
updateFeatures = pyqtSignal(bool)
layerChanged = pyqtSignal(QgsMapLayer)
clearLine = pyqtSignal()
closed = pyqtSignal()
def __init__(self, callbackobject, parent=None):
"""Constructor."""
super(Viewer, self).__init__(parent)
self.setupUi(self)
self.callbackobject = callbackobject
self.frame = self.webview.page().mainFrame()
self.actiongroup = QActionGroup(self)
self.actiongroup.setExclusive(True)
self.actiongroup.triggered.connect(self.action_triggered)
self.measuredialog = MeasureDialog(self)
self.toolbar = QToolBar()
self.qgisTrackButton = self.toolbar.addAction("QGIS Track")
self.qgisTrackButton.setIcon(QIcon(":/icons/track"))
self.qgisTrackButton.setCheckable(True)
self.qgisTrackButton.setChecked(True)
self.qgisTrackButton.toggled.connect(self.trackingChanged.emit)
self.setlocationaction = self.toolbar.addAction("Set location")
self.setlocationaction.setIcon(QIcon(":/icons/location"))
self.setlocationaction.triggered.connect(self.setLocationTriggered.emit)
self.setlocationaction.setCheckable(True)
self.viewfeatures = self.toolbar.addAction("Load QGIS Features")
self.viewfeatures.setIcon(QIcon(":/icons/features"))
self.viewfeatures.setCheckable(True)
self.viewfeatures.setChecked(True)
self.viewfeatures.toggled.connect(self.updateFeatures.emit)
spacer = QWidget()
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.toolbar.addWidget(spacer)
self.measureaction = self.toolbar.addAction("measure")
self.measureaction.setObjectName("Measure")
self.measureaction.setIcon(QIcon(":/icons/measure"))
self.measureaction.setCheckable(True)
self.infoaction = self.toolbar.addAction("Info")
self.infoaction.setObjectName("Info")
self.infoaction.setIcon(QIcon(":/icons/info"))
self.infoaction.setCheckable(True)
self.selectaction = self.toolbar.addAction("Select")
self.selectaction.setObjectName("Select")
self.selectaction.setIcon(QIcon(":/icons/select"))
self.selectaction.setCheckable(True)
self.toolbar.addSeparator()
self.deleteaction = self.toolbar.addAction("Delete")
self.deleteaction.setIcon(QIcon(":/icons/delete"))
self.deleteaction.triggered.connect(self.delete_selected)
self.deleteaction.setEnabled(False)
self.addaction = self.toolbar.addAction("Add")
self.addaction.setObjectName("Add")
self.addaction.setIcon(QIcon(":/icons/add"))
self.addaction.setCheckable(True)
self.moveaction = self.toolbar.addAction("Move")
self.moveaction.setObjectName("Move")
self.moveaction.setIcon(QIcon(":/icons/move"))
self.moveaction.setCheckable(True)
self.actiongroup.addAction(self.moveaction)
self.actiongroup.addAction(self.addaction)
self.actiongroup.addAction(self.infoaction)
self.actiongroup.addAction(self.measureaction)
self.actiongroup.addAction(self.selectaction)
self.activelayercombo = QgsMapLayerComboBox()
self.activelayercombo.layerChanged.connect(self.layer_changed)
self.activelayeraction = self.toolbar.addWidget(self.activelayercombo)
self.activelayercombo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
self.activelayercombo.currentIndexChanged.connect(self.index_changed)
self.zvaluecheck = QCheckBox()
self.zvaluecheck.setChecked(True)
self.zvaluecheck.setText("Copy Z value")
self.zvaluecheck.setToolTip("Copy Z value from viewer to new features in QGIS. Must have a field named Z to enable")
self.zvalueaction = self.toolbar.addWidget(self.zvaluecheck)
self.dockWidgetContents.layout().insertWidget(0, self.toolbar)
self.webview.settings().setAttribute(QWebSettings.PluginsEnabled, True)
self.webview.settings().setAttribute(QWebSettings.JavascriptEnabled, True)
self.webview.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
self.frame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
self.frame.setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
self.frame.javaScriptWindowObjectCleared.connect(self.addcallbackobject)
#.........這裏部分代碼省略.........