[processing] harmonize and improve UI spacing

This commit is contained in:
Mathieu Pellerin 2017-12-27 10:50:52 +07:00 committed by GitHub
parent 9fb386ac60
commit 3b8905209e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 15 deletions

View File

@ -44,7 +44,7 @@ from qgis.core import (QgsProcessingParameterDefinition,
from qgis.PyQt import uic
from qgis.PyQt.QtCore import QCoreApplication, Qt
from qgis.PyQt.QtWidgets import (QWidget, QHBoxLayout, QToolButton,
QLabel, QCheckBox)
QLabel, QCheckBox, QSizePolicy)
from qgis.PyQt.QtGui import QIcon
from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel
@ -66,6 +66,7 @@ class ParametersPanel(BASE, WIDGET):
self.grpAdvanced.hide()
self.scrollAreaWidgetContents.setContentsMargins(4, 4, 4, 4)
self.layoutMain = self.scrollAreaWidgetContents.layout()
self.layoutAdvanced = self.grpAdvanced.layout()
@ -122,12 +123,13 @@ class ParametersPanel(BASE, WIDGET):
if widget is not None:
if isinstance(param, QgsProcessingParameterFeatureSource):
layout = QHBoxLayout()
layout.setSpacing(2)
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)
@ -139,7 +141,7 @@ class ParametersPanel(BASE, WIDGET):
widget.setToolTip(param.toolTip())
if type(widget) is QCheckBox:
if isinstance(widget, QCheckBox):
# checkbox widget - so description is embedded in widget rather than a separate
# label
widget.setText(desc)

View File

@ -458,7 +458,7 @@ class FileWidgetWrapper(WidgetWrapper):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
layout.addWidget(self.combo)
btn = QToolButton()
btn.setText('')
@ -709,7 +709,7 @@ class MapLayerWidgetWrapper(WidgetWrapper):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
self.combo = QgsMapLayerComboBox()
layout.addWidget(self.combo)
btn = QToolButton()
@ -751,7 +751,7 @@ class MapLayerWidgetWrapper(WidgetWrapper):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
layout.addWidget(self.combo)
btn = QToolButton()
btn.setText('')
@ -878,7 +878,7 @@ class FeatureSourceWidgetWrapper(WidgetWrapper):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
self.combo = QgsMapLayerComboBox()
layout.addWidget(self.combo)
layout.setAlignment(self.combo, Qt.AlignTop)
@ -892,7 +892,7 @@ class FeatureSourceWidgetWrapper(WidgetWrapper):
vl = QVBoxLayout()
vl.setMargin(0)
vl.setContentsMargins(0, 0, 0, 0)
vl.setSpacing(2)
vl.setSpacing(6)
vl.addLayout(layout)
self.use_selection_checkbox = QCheckBox(self.tr('Selected features only'))
@ -1181,7 +1181,7 @@ class VectorLayerWidgetWrapper(WidgetWrapper):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
self.combo = QgsMapLayerComboBox()
layout.addWidget(self.combo)
btn = QToolButton()
@ -1238,7 +1238,7 @@ class VectorLayerWidgetWrapper(WidgetWrapper):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
layout.addWidget(self.combo)
btn = QToolButton()
btn.setText('')

View File

@ -15,7 +15,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
<number>6</number>
</property>
<property name="margin">
<number>0</number>
@ -39,7 +39,7 @@
</sizepolicy>
</property>
<property name="text">
<string>...</string>
<string></string>
</property>
</widget>
</item>

View File

@ -39,7 +39,7 @@
</sizepolicy>
</property>
<property name="text">
<string>...</string>
<string></string>
</property>
</widget>
</item>
@ -48,14 +48,14 @@
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Iterate over this layer</string>
</property>
<property name="text">
<string>...</string>
<string></string>
</property>
<property name="checkable">
<bool>true</bool>