本文整理汇总了Python中qgis.PyQt.QtWidgets.QHBoxLayout类的典型用法代码示例。如果您正苦于以下问题:Python QHBoxLayout类的具体用法?Python QHBoxLayout怎么用?Python QHBoxLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QHBoxLayout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setupUi
def setupUi(self):
self.setMinimumWidth(500)
self.setMinimumHeight(400)
self.resize(640, 450)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.bar = QgsMessageBar()
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.verticalLayout.addWidget(self.bar)
self.tree = QTreeWidget(self)
self.tree.setAlternatingRowColors(True)
self.verticalLayout.addWidget(self.tree)
self.horizontalLayout = QHBoxLayout(self)
self.buttonBox = QDialogButtonBox(self)
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
self.horizontalLayout.addWidget(self.buttonBox)
self.verticalLayout.addLayout(self.horizontalLayout)
self.setWindowTitle("Configuration options")
self.tree.headerItem().setText(0, "Setting")
self.tree.headerItem().setText(1, "Value")
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
开发者ID:boundlessgeo,项目名称:qgis-baselayers-plugin,代码行数:26,代码来源:configdialog.py
示例2: _setupUI
def _setupUI(self):
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
self.setMinimumHeight(180)
self.main_horizontal_layout = QHBoxLayout(self)
italic_font = QFont()
italic_font.setItalic(True)
# unselected widget
self.unselected_widget = QListWidget(self)
self._set_list_widget_defaults(self.unselected_widget)
unselected_label = QLabel()
unselected_label.setText("Unselected")
unselected_label.setAlignment(Qt.AlignCenter)
unselected_label.setFont(italic_font)
unselected_v_layout = QVBoxLayout()
unselected_v_layout.addWidget(unselected_label)
unselected_v_layout.addWidget(self.unselected_widget)
# selected widget
self.selected_widget = QListWidget(self)
self._set_list_widget_defaults(self.selected_widget)
selected_label = QLabel()
selected_label.setText("Selected")
selected_label.setAlignment(Qt.AlignCenter)
selected_label.setFont(italic_font)
selected_v_layout = QVBoxLayout()
selected_v_layout.addWidget(selected_label)
selected_v_layout.addWidget(self.selected_widget)
# buttons
self.buttons_vertical_layout = QVBoxLayout()
self.buttons_vertical_layout.setContentsMargins(0, -1, 0, -1)
self.select_all_btn = SmallQPushButton(">>")
self.deselect_all_btn = SmallQPushButton("<<")
self.select_btn = SmallQPushButton(">")
self.deselect_btn = SmallQPushButton("<")
self.select_btn.setToolTip("Add the selected items")
self.deselect_btn.setToolTip("Remove the selected items")
self.select_all_btn.setToolTip("Add all")
self.deselect_all_btn.setToolTip("Remove all")
# add buttons
spacer_label = QLabel() # pragmatic way to create a spacer with
# the same height of the labels on top
# of the lists, in order to align the
# buttons with the lists.
self.buttons_vertical_layout.addWidget(spacer_label)
self.buttons_vertical_layout.addWidget(self.select_btn)
self.buttons_vertical_layout.addWidget(self.deselect_btn)
self.buttons_vertical_layout.addWidget(self.select_all_btn)
self.buttons_vertical_layout.addWidget(self.deselect_all_btn)
# add sub widgets
self.main_horizontal_layout.addLayout(unselected_v_layout)
self.main_horizontal_layout.addLayout(self.buttons_vertical_layout)
self.main_horizontal_layout.addLayout(selected_v_layout)
开发者ID:liminlu0314,项目名称:QGIS,代码行数:60,代码来源:ListMultiselectWidget.py
示例3: setupUi
def setupUi(self):
self.resize(500, 350)
self.setWindowTitle("Remote connections manager")
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.buttonBox = QDialogButtonBox()
self.buttonBox.setOrientation(Qt.Vertical)
self.buttonBox.setStandardButtons(QDialogButtonBox.Close)
self.table = QTableWidget()
self.table.verticalHeader().setVisible(False)
self.table.setSelectionMode(QAbstractItemView.SingleSelection)
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.addRowButton = QPushButton()
self.addRowButton.setText("Add connection")
self.editRowButton = QPushButton()
self.editRowButton.setText("Edit connection")
self.removeRowButton = QPushButton()
self.removeRowButton.setText("Remove connection")
self.buttonBox.addButton(self.addRowButton, QDialogButtonBox.ActionRole)
self.buttonBox.addButton(self.editRowButton, QDialogButtonBox.ActionRole)
self.buttonBox.addButton(self.removeRowButton, QDialogButtonBox.ActionRole)
self.setTableContent()
self.horizontalLayout.addWidget(self.table)
self.horizontalLayout.addWidget(self.buttonBox)
self.setLayout(self.horizontalLayout)
self.buttonBox.rejected.connect(self.close)
self.editRowButton.clicked.connect(self.editRow)
self.addRowButton.clicked.connect(self.addRow)
self.removeRowButton.clicked.connect(self.removeRow)
QMetaObject.connectSlotsByName(self)
self.editRowButton.setEnabled(False)
self.removeRowButton.setEnabled(False)
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:35,代码来源:remotesdialog.py
示例4: __init__
def __init__(self, repo, path):
super(VersionViewerDialog, self).__init__(config.iface.mainWindow(), Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.repo = repo
self.path = path
self.setupUi(self)
self.listWidget.itemClicked.connect(self.commitClicked)
settings = QSettings()
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(0)
horizontalLayout.setMargin(0)
self.mapCanvas = QgsMapCanvas()
self.mapCanvas.setCanvasColor(Qt.white)
self.mapCanvas.enableAntiAliasing(settings.value("/qgis/enable_anti_aliasing", False, type = bool))
self.mapCanvas.useImageToRender(settings.value("/qgis/use_qimage_to_render", False, type = bool))
action = settings.value("/qgis/wheel_action", 0, type = float)
zoomFactor = settings.value("/qgis/zoom_factor", 2, type = float)
self.mapCanvas.setWheelAction(QgsMapCanvas.WheelAction(action), zoomFactor)
horizontalLayout.addWidget(self.mapCanvas)
self.mapWidget.setLayout(horizontalLayout)
self.panTool = QgsMapToolPan(self.mapCanvas)
self.mapCanvas.setMapTool(self.panTool)
versions = repo.log(path = path)
if versions:
for commit in versions:
item = CommitListItem(commit, repo, path)
self.listWidget.addItem(item)
''''w = CommitListItemWidget(commit)
self.ui.listWidget.setItemWidget(item, w)'''
else:
raise GeoGigException("The selected feature is not versioned yet")
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:33,代码来源:versionsviewer.py
示例5: __init__
def __init__(self, parent, tree, providerName, param):
QTreeWidgetItem.__init__(self, parent)
self.providereName = providerName
self.param = param
self.tree = tree
self.setText(0, param.description)
self.paramName = settingName(providerName, param.name)
if isinstance(param.defaultValue, bool):
self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue, type=bool)
if self.value:
self.setCheckState(1, Qt.Checked)
else:
self.setCheckState(1, Qt.Unchecked)
elif isinstance(param.defaultValue, list):
self.combo = QComboBox()
for element in param.defaultValue:
self.combo.addItem(element)
self.tree.setItemWidget(self, 1, self.combo)
self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue[0])
idx = self.combo.findText(self.value)
self.combo.setCurrentIndex(idx)
elif param.description == "Password":
self.passwordField = QLineEdit()
self.passwordField.setEchoMode(QLineEdit.Password);
#self.passwordField.setStyleSheet("QLineEdit { border: none }");
self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue)
self.passwordField.setText(str(self.value))
self.tree.setItemWidget(self, 1, self.passwordField)
elif param.action is not None:
layout = QHBoxLayout()
layout.setMargin(0)
layout.setSpacing(0)
self.textbox = QLineEdit()
self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue)
self.textbox.setText(str(self.value))
layout.addWidget(self.textbox)
self.button = QToolButton()
self.button.setText(param.actionText)
self.button.clicked.connect(param.action)
layout.addWidget(self.button)
self.widget = QWidget()
self.widget.setLayout(layout)
self.tree.setItemWidget(self, 1, self.widget)
else:
self.textbox = QLineEdit()
#self.textbox.setStyleSheet("QLineEdit { border: none }");
self.tree.setItemWidget(self, 1, self.textbox)
self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue)
self.textbox.setText(str(self.value))
开发者ID:boundlessgeo,项目名称:qgis-baselayers-plugin,代码行数:49,代码来源:configdialog.py
示例6: __init__
def __init__(self, parent):
super(ConfigOptionsPage, self).__init__(parent)
self.config_widget = ConfigDialog()
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setMargin(0)
self.setLayout(layout)
layout.addWidget(self.config_widget)
self.setObjectName('processingOptions')
开发者ID:cz172638,项目名称:QGIS,代码行数:9,代码来源:ConfigDialog.py
示例7: treeItemClicked
def treeItemClicked(self, item):
if item.childCount():
return
color = {"MODIFIED": QColor(255, 170, 0), "ADDED":Qt.green,
"REMOVED":Qt.red , "NO_CHANGE":Qt.white}
changeTypeName = ["", "ADDED", "MODIFIED", "REMOVED"]
path = item.text(0)
if path not in self.changes:
return
oldfeature = self.changes[path].oldfeature
newfeature = self.changes[path].newfeature
changetype = self.changes[path].changetype
self.attributesTable.clear()
self.attributesTable.verticalHeader().show()
self.attributesTable.horizontalHeader().show()
self.attributesTable.setRowCount(len(newfeature))
self.attributesTable.setVerticalHeaderLabels([a for a in newfeature])
self.attributesTable.setHorizontalHeaderLabels(["Old value", "New value", "Change type"])
for i, attrib in enumerate(newfeature):
self.attributesTable.setItem(i, 0, DiffItem(oldfeature.get(attrib, None)))
self.attributesTable.setItem(i, 1, DiffItem(newfeature.get(attrib, None)))
attribChangeType = changeTypeName[changetype]
isChangedGeom = False
if changetype == LOCAL_FEATURE_MODIFIED:
oldvalue = oldfeature.get(attrib, None)
newvalue = newfeature.get(attrib, None)
try:# to avoid false change detection due to different precisions
oldvalue = QgsGeometry.fromWkt(oldvalue).exportToWkt(7)
newvalue = QgsGeometry.fromWkt(newvalue).exportToWkt(7)
if oldvalue != newvalue and None not in [oldvalue, newvalue]:
widget = QWidget()
btn = QPushButton()
btn.setText("View detail")
g1 = QgsGeometry.fromWkt(oldvalue)
g2 = QgsGeometry.fromWkt(newvalue)
btn.clicked.connect(lambda: self.viewGeometryChanges(g1, g2))
label = QLabel()
label.setText(attribChangeType)
layout = QHBoxLayout(widget)
layout.addWidget(label);
layout.addWidget(btn);
layout.setContentsMargins(0, 0, 0, 0)
widget.setLayout(layout)
self.attributesTable.setItem(i, 2, QTableWidgetItem(""))
self.attributesTable.setCellWidget(i, 2, widget)
isChangedGeom = True
except:
pass
if oldvalue == newvalue:
attribChangeType = "NO_CHANGE"
if not isChangedGeom:
self.attributesTable.setItem(i, 2, QTableWidgetItem(attribChangeType))
for col in range(3):
self.attributesTable.item(i, col).setBackgroundColor(color[attribChangeType]);
self.attributesTable.resizeColumnsToContents()
self.attributesTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:56,代码来源:localdiffviewerdialog.py
示例8: initGui
def initGui(self):
self.combo = ExtendedComboBox()
self.fillCombo()
self.combo.setEditable(True)
self.label = QLabel("Enter command:")
self.errorLabel = QLabel("Enter command:")
self.vlayout = QVBoxLayout()
self.vlayout.setSpacing(2)
self.vlayout.setMargin(0)
self.vlayout.addSpacerItem(QSpacerItem(0, OFFSET, QSizePolicy.Maximum, QSizePolicy.Expanding))
self.hlayout = QHBoxLayout()
self.hlayout.addWidget(self.label)
self.vlayout.addLayout(self.hlayout)
self.hlayout2 = QHBoxLayout()
self.hlayout2.addWidget(self.combo)
self.vlayout.addLayout(self.hlayout2)
self.vlayout.addSpacerItem(QSpacerItem(0, OFFSET, QSizePolicy.Maximum, QSizePolicy.Expanding))
self.setLayout(self.vlayout)
self.combo.lineEdit().returnPressed.connect(self.run)
self.prepareGui()
开发者ID:GrokImageCompression,项目名称:QGIS,代码行数:21,代码来源:CommanderWindow.py
示例9: __init__
def __init__(self, conflicts):
super(ConflictDialog, self).__init__(None, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.solved = False
self.resolvedConflicts = {}
self.conflicts = conflicts
self.setupUi(self)
self.setWindowFlags(self.windowFlags() |
Qt.WindowSystemMenuHint |
Qt.WindowMinMaxButtonsHint)
self.zoomButton.clicked.connect(self.zoomToFullExtent)
self.solveButton.clicked.connect(self.solve)
self.conflictsTree.itemClicked.connect(self.treeItemClicked)
self.attributesTable.cellClicked.connect(self.cellClicked)
self.solveAllLocalButton.clicked.connect(self.solveAllLocal)
self.solveAllRemoteButton.clicked.connect(self.solveAllRemote)
self.solveLocalButton.clicked.connect(self.solveLocal)
self.solveRemoteButton.clicked.connect(self.solveRemote)
self.showRemoteCheck.stateChanged.connect(self.showGeoms)
self.showLocalCheck.stateChanged.connect(self.showGeoms)
self.lastSelectedItem = None
self.currentPath = None
self.currentConflict = None
self.theirsLayer = None
self.oursLayer = None
settings = QSettings()
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(0)
horizontalLayout.setMargin(0)
self.mapCanvas = QgsMapCanvas()
self.mapCanvas.setCanvasColor(Qt.white)
self.mapCanvas.enableAntiAliasing(settings.value("/qgis/enable_anti_aliasing", False, type = bool))
self.mapCanvas.useImageToRender(settings.value("/qgis/use_qimage_to_render", False, type = bool))
self.mapCanvas.mapRenderer().setProjectionsEnabled(True)
action = settings.value("/qgis/wheel_action", 0, type = float)
zoomFactor = settings.value("/qgis/zoom_factor", 2, type = float)
self.mapCanvas.setWheelAction(QgsMapCanvas.WheelAction(action), zoomFactor)
horizontalLayout.addWidget(self.mapCanvas)
self.canvasWidget.setLayout(horizontalLayout)
self.panTool = QgsMapToolPan(self.mapCanvas)
self.mapCanvas.setMapTool(self.panTool)
self.solveButton.setEnabled(False)
self.solveLocalButton.setEnabled(False)
self.solveRemoteButton.setEnabled(False)
self.fillConflictsTree()
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:51,代码来源:conflictdialog.py
示例10: FileDirectorySelector
class FileDirectorySelector(QWidget):
def __init__(self, parent=None, selectFile=False):
QWidget.__init__(self, parent)
# create gui
self.btnSelect = QToolButton()
self.btnSelect.setText('…')
self.lineEdit = QLineEdit()
self.hbl = QHBoxLayout()
self.hbl.setMargin(0)
self.hbl.setSpacing(0)
self.hbl.addWidget(self.lineEdit)
self.hbl.addWidget(self.btnSelect)
self.setLayout(self.hbl)
self.canFocusOut = False
self.selectFile = selectFile
self.setFocusPolicy(Qt.StrongFocus)
self.btnSelect.clicked.connect(self.select)
def select(self):
lastDir = ''
if not self.selectFile:
selectedPath = QFileDialog.getExistingDirectory(None,
self.tr('Select directory'), lastDir,
QFileDialog.ShowDirsOnly)
else:
selectedPath, selected_filter = QFileDialog.getOpenFileName(None,
self.tr('Select file'), lastDir, self.tr('All files (*.*)')
)
if not selectedPath:
return
self.lineEdit.setText(selectedPath)
self.canFocusOut = True
def text(self):
return self.lineEdit.text()
def setText(self, value):
self.lineEdit.setText(value)
开发者ID:mj10777,项目名称:QGIS,代码行数:45,代码来源:ConfigDialog.py
示例11: RefPanel
class RefPanel(QWidget):
refChanged = pyqtSignal()
def __init__(self, repo, ref = None):
super(RefPanel, self).__init__(None)
self.repo = repo
self.ref = ref
self.horizontalLayout = QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.text = QLineEdit()
self.text.setEnabled(False)
if ref is not None:
self.text.setText(ref.humantext())
self.text.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QToolButton()
self.pushButton.setText("...")
self.pushButton.clicked.connect(self.showSelectionDialog)
self.pushButton.setEnabled(self.repo is not None)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
def showSelectionDialog(self):
from geogig.gui.dialogs.historyviewer import HistoryViewerDialog
dialog = HistoryViewerDialog(self.repo)
dialog.exec_()
ref = dialog.ref
if ref:
commit = Commit.fromref(self.repo, ref)
self.setRef(commit)
def setRepo(self, repo):
self.repo = repo
self.pushButton.setEnabled(True)
self.setRef(Commitish(repo, repo.HEAD))
def setRef(self, ref):
self.ref = ref
self.text.setText(ref.humantext())
self.refChanged.emit()
def getRef(self):
return self.ref
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:45,代码来源:geogigref.py
示例12: __init__
def __init__(self, iface):
QDialog.__init__(self, iface.mainWindow())
self.workerThread = None
self.state = False
self.outputLoc = None
self.resultStatus = None
self.reRun = False
self.savedProj = None
# Build GUI Elements
self.setWindowTitle("SEILAPLAN wird ausgeführt")
self.resize(500, 100)
self.container = QVBoxLayout()
self.progressBar = QProgressBar(self)
self.progressBar.setMinimumWidth(500)
self.statusLabel = QLabel(self)
self.hbox = QHBoxLayout()
self.cancelButton = QDialogButtonBox()
self.closeButton = QDialogButtonBox()
self.resultLabel = ClickLabel(self)
self.resultLabel.setMaximumWidth(500)
self.resultLabel.setSizePolicy(
QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding))
self.resultLabel.setWordWrap(True)
self.rerunButton = QPushButton("Berechnungen wiederholen")
self.rerunButton.setVisible(False)
spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
QSizePolicy.Minimum)
self.cancelButton.setStandardButtons(QDialogButtonBox.Cancel)
self.cancelButton.clicked.connect(self.onAbort)
self.closeButton.setStandardButtons(QDialogButtonBox.Close)
self.closeButton.clicked.connect(self.onClose)
self.hbox.addWidget(self.rerunButton)
self.hbox.addItem(spacer)
self.hbox.addWidget(self.cancelButton)
self.hbox.setAlignment(self.cancelButton, Qt.AlignHCenter)
self.hbox.addWidget(self.closeButton)
self.hbox.setAlignment(self.closeButton, Qt.AlignHCenter)
self.closeButton.hide()
self.container.addWidget(self.progressBar)
self.container.addWidget(self.statusLabel)
self.container.addWidget(self.resultLabel)
self.container.addLayout(self.hbox)
self.container.setSizeConstraint(QLayout.SetFixedSize)
self.setLayout(self.container)
开发者ID:piMoll,项目名称:SEILAPLAN,代码行数:47,代码来源:progressDialog.py
示例13: __init__
def __init__(self, parameter, parent=None):
"""Constructor.
:param parameter: A DefaultValueParameter object.
:type parameter: DefaultValueParameter
"""
super(DefaultValueParameterWidget, self).__init__(parameter, parent)
self.radio_button_layout = QHBoxLayout()
# Create radio button group
self.input_button_group = QButtonGroup()
for i in range(len(self._parameter.labels)):
if '%s' in self._parameter.labels[i]:
label = (
self._parameter.labels[i] %
self._parameter.options[i])
else:
label = self._parameter.labels[i]
radio_button = QRadioButton(label)
self.radio_button_layout.addWidget(radio_button)
self.input_button_group.addButton(radio_button, i)
if self._parameter.value == \
self._parameter.options[i]:
radio_button.setChecked(True)
# Create double spin box for custom value
self.custom_value = QDoubleSpinBox()
self.custom_value.setSingleStep(0.1)
if self._parameter.options[-1]:
self.custom_value.setValue(self._parameter.options[-1])
self.radio_button_layout.addWidget(self.custom_value)
self.toggle_custom_value()
self.inner_input_layout.addLayout(self.radio_button_layout)
# Connect
# noinspection PyUnresolvedReferences
self.input_button_group.buttonClicked.connect(
self.toggle_custom_value)
开发者ID:inasafe,项目名称:inasafe,代码行数:44,代码来源:default_value_parameter_widget.py
示例14: MultipleDirectorySelector
class MultipleDirectorySelector(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
# create gui
self.btnSelect = QToolButton()
self.btnSelect.setText('…')
self.lineEdit = QLineEdit()
self.hbl = QHBoxLayout()
self.hbl.setMargin(0)
self.hbl.setSpacing(0)
self.hbl.addWidget(self.lineEdit)
self.hbl.addWidget(self.btnSelect)
self.setLayout(self.hbl)
self.canFocusOut = False
self.setFocusPolicy(Qt.StrongFocus)
self.btnSelect.clicked.connect(self.select)
def select(self):
text = self.lineEdit.text()
if text != '':
items = text.split(';')
else:
items = []
dlg = DirectorySelectorDialog(None, items)
if dlg.exec_():
text = dlg.value()
self.lineEdit.setText(text)
self.canFocusOut = True
def text(self):
return self.lineEdit.text()
def setText(self, value):
self.lineEdit.setText(value)
开发者ID:phborba,项目名称:QGIS,代码行数:41,代码来源:ConfigDialog.py
示例15: __init__
def __init__(self, parent=None):
QWidget.__init__(self, parent)
# create gui
self.btnSelect = QToolButton()
self.btnSelect.setText('…')
self.lineEdit = QLineEdit()
self.hbl = QHBoxLayout()
self.hbl.setMargin(0)
self.hbl.setSpacing(0)
self.hbl.addWidget(self.lineEdit)
self.hbl.addWidget(self.btnSelect)
self.setLayout(self.hbl)
self.canFocusOut = False
self.setFocusPolicy(Qt.StrongFocus)
self.btnSelect.clicked.connect(self.select)
开发者ID:mj10777,项目名称:QGIS,代码行数:19,代码来源:ConfigDialog.py
示例16: __init__
def __init__(self, repo, ref = None):
super(RefPanel, self).__init__(None)
self.repo = repo
self.ref = ref
self.horizontalLayout = QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.text = QLineEdit()
self.text.setEnabled(False)
if ref is not None:
self.text.setText(ref.humantext())
self.text.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QToolButton()
self.pushButton.setText("...")
self.pushButton.clicked.connect(self.showSelectionDialog)
self.pushButton.setEnabled(self.repo is not None)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:19,代码来源:geogigref.py
示例17: __init__
def __init__(self, param, row, col, dialog):
super(BatchInputSelectionPanel, self).__init__(None)
self.param = param
self.dialog = dialog
self.row = row
self.col = col
self.horizontalLayout = QHBoxLayout(self)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setMargin(0)
self.text = QLineEdit()
self.text.setObjectName("text")
self.text.setMinimumWidth(300)
self.setValue("")
self.text.editingFinished.connect(self.textEditingFinished)
self.text.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QPushButton()
self.pushButton.setText("...")
self.pushButton.clicked.connect(self.showPopupMenu)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
开发者ID:borysiasty,项目名称:QGIS,代码行数:21,代码来源:BatchInputSelectionPanel.py
示例18: __init__
def __init__(self, param, row, col, panel):
super(BatchInputSelectionPanel, self).__init__(None)
self.param = param
self.panel = panel
self.table = self.panel.tblParameters
self.row = row
self.col = col
self.horizontalLayout = QHBoxLayout(self)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setMargin(0)
self.text = QLineEdit()
self.text.setMinimumWidth(300)
self.text.setText('')
self.text.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QPushButton()
self.pushButton.setText('...')
self.pushButton.clicked.connect(self.showPopupMenu)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
开发者ID:fritsvanveen,项目名称:QGIS,代码行数:21,代码来源:BatchInputSelectionPanel.py
示例19: __init__
def __init__(self, output, alg, row, col, panel):
super(BatchOutputSelectionPanel, self).__init__(None)
self.alg = alg
self.row = row
self.col = col
self.output = output
self.panel = panel
self.table = self.panel.tblParameters
self.horizontalLayout = QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.text = QLineEdit()
self.text.setText('')
self.text.setMinimumWidth(300)
self.text.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QPushButton()
self.pushButton.setText('…')
self.pushButton.clicked.connect(self.showSelectionDialog)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
开发者ID:blazek,项目名称:QGIS,代码行数:22,代码来源:BatchOutputSelectionPanel.py
示例20: initWidgets
def initWidgets(self):
# If there are advanced parameters — show corresponding groupbox
for param in self.alg.parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagAdvanced:
self.grpAdvanced.show()
break
widget_context = QgsProcessingParameterWidgetContext()
if iface is not None:
widget_context.setMapCanvas(iface.mapCanvas())
# Create widgets and put them in layouts
for param in self.alg.parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
continue
if param.isDestination():
continue
else:
wrapper = WidgetWrapperFactory.create_wrapper(param, self.parent)
self.wrappers[param.name()] = wrapper
# For compatibility with 3.x API, we need to check whether the wrapper is
# the deprecated WidgetWrapper class. If not, it's the newer
# QgsAbstractProcessingParameterWidgetWrapper class
# TODO QGIS 4.0 - remove
is_python_wrapper = issubclass(wrapper.__class__, WidgetWrapper)
if not is_python_wrapper:
wrapper.setWidgetContext(widget_context)
widget = wrapper.createWrappedWidget(self.processing_context)
wrapper.registerProcessingContextGenerator(self.context_generator)
else:
widget = wrapper.widget
if self.in_place and param.name() in ('INPUT', 'OUTPUT'):
# don't show the input/output parameter widgets in in-place mode
# we still need to CREATE them, because other wrappers may need to interact
# with them (e.g. those parameters which need the input layer for field
# selections/crs properties/etc)
continue
if widget is not None:
if is_python_wrapper:
widget.setToolTip(param.toolTip())
if isinstance(param, QgsProcessingParameterFeatureSource):
layout = QHBoxLayout()
layout.setSpacing(6)
layout.setMargin(0)
layout.addWidget(widget)
button = QToolButton()
icon = QIcon(os.path.join(pluginPath, 'images', 'iterate.png'))
button.setIcon(icon)
button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
button.setToolTip(self.tr('Iterate over this layer, creating a separate output for every feature in the layer'))
button.setCheckable(True)
layout.addWidget(button)
layout.setAlignment(button, Qt.AlignTop)
self.iterateButtons[param.name()] = button
button.toggled.connect(self.buttonToggled)
widget = QWidget()
widget.setLayout(layout)
label = None
if not is_python_wrapper:
label = wrapper.createWrappedLabel()
else:
label = wrapper.label
if label is not None:
if param.flags() & QgsProcessingParameterDefinition.FlagAdvanced:
self.layoutAdvanced.addWidget(label)
else:
self.layoutMain.insertWidget(
self.layoutMain.count() - 2, label)
elif is_python_wrapper:
desc = param.description()
if isinstance(param, QgsProcessingParameterExtent):
desc += self.tr(' (xmin, xmax, ymin, ymax)')
if isinstance(param, QgsProcessingParameterPoint):
desc += self.tr(' (x, y)')
if param.flags() & QgsProcessingParameterDefinition.FlagOptional:
desc += self.tr(' [optional]')
widget.setText(desc)
if param.flags() & QgsProcessingParameterDefinition.FlagAdvanced:
self.layoutAdvanced.addWidget(widget)
else:
self.layoutMain.insertWidget(
self.layoutMain.count() - 2, widget)
for output in self.alg.destinationParameterDefinitions():
if output.flags() & QgsProcessingParameterDefinition.FlagHidden:
continue
if self.in_place and param.name() in ('INPUT', 'OUTPUT'):
continue
label = QLabel(output.description())
widget = DestinationSelectionPanel(output, self.alg)
self.layoutMain.insertWidget(self.layoutMain.count() - 1, label)
#.........这里部分代码省略.........
开发者ID:enricofer,项目名称:QGIS,代码行数:101,代码来源:ParametersPanel.py
注:本文中的qgis.PyQt.QtWidgets.QHBoxLayout类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论