eric6/Templates/TemplateMultipleVariablesDialog.py

changeset 8220
006ee31b4835
parent 8218
7c09585bd960
diff -r 013aee248a62 -r 006ee31b4835 eric6/Templates/TemplateMultipleVariablesDialog.py
--- a/eric6/Templates/TemplateMultipleVariablesDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Templates/TemplateMultipleVariablesDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -53,8 +53,7 @@
 
         # populate the scrollarea with labels and text edits
         self.variablesEntries = {}
-        row = 0
-        for var in variables:
+        for row, var in enumerate(variables):
             label = QLabel("{0}:".format(var), self.top)
             self.grid.addWidget(label, row, 0,
                                 Qt.Alignment(Qt.AlignmentFlag.AlignTop))
@@ -69,11 +68,10 @@
                 t = QLineEdit(self.top)
             self.grid.addWidget(t, row, 1)
             self.variablesEntries[var] = t
-            row += 1
         # add a spacer to make the entries aligned at the top
         spacer = QSpacerItem(
             20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
-        self.grid.addItem(spacer, row, 1)
+        self.grid.addItem(spacer, self.grid.rowCount(), 1)
         self.variablesEntries[variables[0]].setFocus()
         self.top.adjustSize()
 

eric ide

mercurial