本文整理汇总了Python中qgis.gui.QgsFieldComboBox.setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:Python QgsFieldComboBox.setSizePolicy方法的具体用法?Python QgsFieldComboBox.setSizePolicy怎么用?Python QgsFieldComboBox.setSizePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.gui.QgsFieldComboBox
的用法示例。
在下文中一共展示了QgsFieldComboBox.setSizePolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_Autocorrelation
# 需要导入模块: from qgis.gui import QgsFieldComboBox [as 别名]
# 或者: from qgis.gui.QgsFieldComboBox import setSizePolicy [as 别名]
class Ui_Autocorrelation(object):
def setupUi(self, Autocorrelation):
Autocorrelation.setObjectName(_fromUtf8("Autocorrelation"))
Autocorrelation.setWindowModality(QtCore.Qt.NonModal)
Autocorrelation.resize(674, 462)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Autocorrelation.sizePolicy().hasHeightForWidth())
Autocorrelation.setSizePolicy(sizePolicy)
Autocorrelation.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
self.verticalLayout = QtGui.QVBoxLayout(Autocorrelation)
self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.formLayout = QtGui.QFormLayout()
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label = QtGui.QLabel(Autocorrelation)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label)
self.cbx_aggregation_layer = QgsMapLayerComboBox(Autocorrelation)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.cbx_aggregation_layer.sizePolicy().hasHeightForWidth())
self.cbx_aggregation_layer.setSizePolicy(sizePolicy)
self.cbx_aggregation_layer.setObjectName(_fromUtf8("cbx_aggregation_layer"))
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.cbx_aggregation_layer)
self.label_4 = QtGui.QLabel(Autocorrelation)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_4)
self.cbx_indicator_field = QgsFieldComboBox(Autocorrelation)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.cbx_indicator_field.sizePolicy().hasHeightForWidth())
self.cbx_indicator_field.setSizePolicy(sizePolicy)
self.cbx_indicator_field.setObjectName(_fromUtf8("cbx_indicator_field"))
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.cbx_indicator_field)
self.horizontalLayout_6 = QtGui.QHBoxLayout()
self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
self.le_output_filepath = QtGui.QLineEdit(Autocorrelation)
self.le_output_filepath.setObjectName(_fromUtf8("le_output_filepath"))
self.horizontalLayout_6.addWidget(self.le_output_filepath)
self.button_browse = QtGui.QPushButton(Autocorrelation)
self.button_browse.setObjectName(_fromUtf8("button_browse"))
self.horizontalLayout_6.addWidget(self.button_browse)
self.formLayout.setLayout(12, QtGui.QFormLayout.FieldRole, self.horizontalLayout_6)
self.label_3 = QtGui.QLabel(Autocorrelation)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.label_3)
self.cbx_contiguity = QtGui.QComboBox(Autocorrelation)
self.cbx_contiguity.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.cbx_contiguity.sizePolicy().hasHeightForWidth())
self.cbx_contiguity.setSizePolicy(sizePolicy)
self.cbx_contiguity.setMinimumSize(QtCore.QSize(104, 0))
self.cbx_contiguity.setObjectName(_fromUtf8("cbx_contiguity"))
self.cbx_contiguity.addItem(_fromUtf8(""))
self.cbx_contiguity.addItem(_fromUtf8(""))
self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.cbx_contiguity)
self.label_8 = QtGui.QLabel(Autocorrelation)
self.label_8.setObjectName(_fromUtf8("label_8"))
self.formLayout.setWidget(12, QtGui.QFormLayout.LabelRole, self.label_8)
self.verticalLayout.addLayout(self.formLayout)
self.button_box_ok = QtGui.QDialogButtonBox(Autocorrelation)
self.button_box_ok.setOrientation(QtCore.Qt.Horizontal)
self.button_box_ok.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.button_box_ok.setObjectName(_fromUtf8("button_box_ok"))
self.verticalLayout.addWidget(self.button_box_ok)
self.retranslateUi(Autocorrelation)
QtCore.QObject.connect(self.cbx_aggregation_layer, QtCore.SIGNAL(_fromUtf8("layerChanged(QgsMapLayer*)")), self.cbx_indicator_field.setLayer)
QtCore.QMetaObject.connectSlotsByName(Autocorrelation)
def retranslateUi(self, Autocorrelation):
Autocorrelation.setWindowTitle(_translate("Autocorrelation", "Autocorrelation", None))
self.label.setText(_translate("Autocorrelation", "Layer", None))
self.label_4.setText(_translate("Autocorrelation", "Field", None))
self.le_output_filepath.setPlaceholderText(_translate("Autocorrelation", "Save to temporary file", None))
self.button_browse.setText(_translate("Autocorrelation", "Browse", None))
self.label_3.setText(_translate("Autocorrelation", "Contiguity", None))
self.cbx_contiguity.setItemText(0, _translate("Autocorrelation", "Queen", None))
self.cbx_contiguity.setItemText(1, _translate("Autocorrelation", "Rook", None))
self.label_8.setText(_translate("Autocorrelation", "Output", None))
示例2: SettingsDialog
# 需要导入模块: from qgis.gui import QgsFieldComboBox [as 别名]
# 或者: from qgis.gui.QgsFieldComboBox import setSizePolicy [as 别名]
class SettingsDialog(QDialog):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.resize(500, 100)
self.setWindowTitle("Settings")
layout = QGridLayout(self)
csTargetLayerName = getCSLayerName()
bufferTargetLayerName = getRZLayerName()
csLable = QLabel("Compressor staitions layer:")
csLable.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
layout.addWidget(csLable, 0, 0)
self.__csLayerName = QgsMapLayerComboBox()
self.__csLayerName.setEditable(True)
self.__csLayerName.setFilters(QgsMapLayerProxyModel.PointLayer)
self.__csLayerName.setEditText(csTargetLayerName)
self.__csLayerName.layerChanged.connect(self.csLayerChooze)
self.__csLayerName.editTextChanged.connect(self.csLayernameSave)
self.__csLayerName.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
layout.addWidget(self.__csLayerName, 0, 1)
self.__csIdField = QgsFieldComboBox()
self.__csIdField.setEditable(True)
self.__csIdField.fieldChanged.connect(self.csIdFiledChooze)
self.__csIdField.editTextChanged.connect(self.csIdFieldSave)
self.__csIdField.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.csIdFieldFill()
layout.addWidget(self.__csIdField, 0, 2)
bufferLable = QLabel("Buffer layer:")
bufferLable.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
layout.addWidget(bufferLable, 1, 0)
# self.__bufferLayerName = QLineEdit(bufferTargetLayerName, self)
# self.__bufferLayerName.editingFinished.connect(self.bufferTargetLayernameSave)
self.__bufferLayerName = QgsMapLayerComboBox()
self.__bufferLayerName.setEditable(True)
self.__bufferLayerName.setFilters(QgsMapLayerProxyModel.PolygonLayer)
self.__bufferLayerName.setEditText(bufferTargetLayerName)
self.__bufferLayerName.layerChanged.connect(self.bufferLayerChooze)
self.__bufferLayerName.editTextChanged.connect(self.bufferLayernameSave)
layout.addWidget(self.__bufferLayerName, 1, 1)
def csLayerChooze(self, qgsMapLayer):
self.__csLayerName.setEditText(qgsMapLayer.name())
def csLayernameSave(self, csTargetLayerName):
if csTargetLayerName == u"":
return
setCSLayerName(csTargetLayerName)
self.csIdFieldFill()
def csIdFieldFill(self):
csIdField = getCSIdField()
csTargetLayerName = getCSLayerName()
layers = QgsMapLayerRegistry.instance().mapLayersByName(csTargetLayerName)
if len(layers) > 0:
self.__csIdField.setLayer(layers[0])
else:
self.__csIdField.setLayer(None)
self.__csIdField.setEditText(csIdField)
def csIdFiledChooze(self, fieldName):
self.__csIdField.setEditText(fieldName)
def csIdFieldSave(self, fieldName):
settings = QSettings()
if fieldName == u"":
return
setCSIdField(fieldName)
def bufferLayerChooze(self, qgsMapLayer):
self.__bufferLayerName.setEditText(qgsMapLayer.name())
def bufferLayernameSave(self, bufferTargetLayerName):
settings = QSettings()
if bufferTargetLayerName == u"":
return
setRZLayerName(bufferTargetLayerName)
示例3: Ui_Composite_Index
# 需要导入模块: from qgis.gui import QgsFieldComboBox [as 别名]
# 或者: from qgis.gui.QgsFieldComboBox import setSizePolicy [as 别名]
class Ui_Composite_Index(object):
def setupUi(self, Composite_Index):
Composite_Index.setObjectName(_fromUtf8("Composite_Index"))
Composite_Index.resize(814, 754)
self.verticalLayout = QtGui.QVBoxLayout(Composite_Index)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.formLayout = QtGui.QFormLayout()
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.label = QtGui.QLabel(Composite_Index)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label)
self.cbx_aggregation_layer = QgsMapLayerComboBox(Composite_Index)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.cbx_aggregation_layer.sizePolicy().hasHeightForWidth())
self.cbx_aggregation_layer.setSizePolicy(sizePolicy)
self.cbx_aggregation_layer.setObjectName(_fromUtf8("cbx_aggregation_layer"))
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.cbx_aggregation_layer)
self.label_4 = QtGui.QLabel(Composite_Index)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_4)
self.cbx_indicator_field = QgsFieldComboBox(Composite_Index)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.cbx_indicator_field.sizePolicy().hasHeightForWidth())
self.cbx_indicator_field.setSizePolicy(sizePolicy)
self.cbx_indicator_field.setObjectName(_fromUtf8("cbx_indicator_field"))
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.cbx_indicator_field)
self.label_3 = QtGui.QLabel(Composite_Index)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.formLayout.setWidget(11, QtGui.QFormLayout.LabelRole, self.label_3)
self.label_8 = QtGui.QLabel(Composite_Index)
self.label_8.setObjectName(_fromUtf8("label_8"))
self.formLayout.setWidget(12, QtGui.QFormLayout.LabelRole, self.label_8)
self.horizontalLayout_6 = QtGui.QHBoxLayout()
self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
self.le_output_filepath = QtGui.QLineEdit(Composite_Index)
self.le_output_filepath.setObjectName(_fromUtf8("le_output_filepath"))
self.horizontalLayout_6.addWidget(self.le_output_filepath)
self.button_browse = QtGui.QPushButton(Composite_Index)
self.button_browse.setObjectName(_fromUtf8("button_browse"))
self.horizontalLayout_6.addWidget(self.button_browse)
self.formLayout.setLayout(12, QtGui.QFormLayout.FieldRole, self.horizontalLayout_6)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.formLayout.setLayout(13, QtGui.QFormLayout.FieldRole, self.horizontalLayout)
self.radioButton_vector_positive = QtGui.QRadioButton(Composite_Index)
self.radioButton_vector_positive.setChecked(True)
self.radioButton_vector_positive.setObjectName(_fromUtf8("radioButton_vector_positive"))
self.buttonGroup_2 = QtGui.QButtonGroup(Composite_Index)
self.buttonGroup_2.setObjectName(_fromUtf8("buttonGroup_2"))
self.buttonGroup_2.addButton(self.radioButton_vector_positive)
self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.radioButton_vector_positive)
self.radioButton_vector_negative = QtGui.QRadioButton(Composite_Index)
self.radioButton_vector_negative.setObjectName(_fromUtf8("radioButton_vector_negative"))
self.buttonGroup_2.addButton(self.radioButton_vector_negative)
self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.radioButton_vector_negative)
self.le_new_column = QtGui.QLineEdit(Composite_Index)
self.le_new_column.setMaxLength(10)
self.le_new_column.setObjectName(_fromUtf8("le_new_column"))
self.formLayout.setWidget(11, QtGui.QFormLayout.FieldRole, self.le_new_column)
self.cbx_list_indicators = QtGui.QListWidget(Composite_Index)
self.cbx_list_indicators.setObjectName(_fromUtf8("cbx_list_indicators"))
self.formLayout.setWidget(10, QtGui.QFormLayout.FieldRole, self.cbx_list_indicators)
self.command_link_button = QtGui.QCommandLinkButton(Composite_Index)
self.command_link_button.setObjectName(_fromUtf8("command_link_button"))
self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.command_link_button)
self.label_2 = QtGui.QLabel(Composite_Index)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.formLayout.setWidget(9, QtGui.QFormLayout.FieldRole, self.label_2)
self.verticalLayout.addLayout(self.formLayout)
self.symbology = QgsCollapsibleGroupBox(Composite_Index)
self.symbology.setCheckable(True)
self.symbology.setProperty("collapsed", False)
self.symbology.setObjectName(_fromUtf8("symbology"))
self.verticalLayout_3 = QtGui.QVBoxLayout(self.symbology)
self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.label_9 = QtGui.QLabel(self.symbology)
self.label_9.setObjectName(_fromUtf8("label_9"))
self.horizontalLayout_3.addWidget(self.label_9)
self.color_low_value = QgsColorButtonV2(self.symbology)
self.color_low_value.setProperty("color", QtGui.QColor(50, 164, 46))
self.color_low_value.setObjectName(_fromUtf8("color_low_value"))
self.horizontalLayout_3.addWidget(self.color_low_value)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem)
self.label_10 = QtGui.QLabel(self.symbology)
self.label_10.setObjectName(_fromUtf8("label_10"))
self.horizontalLayout_3.addWidget(self.label_10)
self.color_high_value = QgsColorButtonV2(self.symbology)
self.color_high_value.setProperty("color", QtGui.QColor(202, 33, 36))
self.color_high_value.setObjectName(_fromUtf8("color_high_value"))
self.horizontalLayout_3.addWidget(self.color_high_value)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtGui.QHBoxLayout()
#.........这里部分代码省略.........