Graphics Reference
In-Depth Information
With the preceding sets of options defined, we can now start to lay out the contents of our
dialog window. We'll start by using a QFormLayout object that lets us lay out form la-
bels and widgets side by side:
self.form = QFormLayout()
We next want to define the various input widgets we'll use to display and change the track
attributes:
self.trackType = QComboBox(self)
self.trackType.addItems(self.trackTypes)
self.trackName = QLineEdit(self)
self.trackDirection = QComboBox(self)
self.trackDirection.addItems(self.directions)
self.trackStatus = QComboBox(self)
self.trackStatus.addItems(self.statuses)
Now that we have the widgets themselves, let's add them to the form:
self.form.addRow("Type", self.trackType)
self.form.addRow("Name", self.trackName)
self.form.addRow("Direction", self.trackDirection)
self.form.addRow("Status", self.trackStatus)
Next, we want to define the buttons at the bottom of our dialog window:
self.buttons = QHBoxLayout()
self.okButton = QPushButton("OK", self)
self.connect(self.okButton, SIGNAL("clicked()"),
self.accept)
self.cancelButton = QPushButton("Cancel", self)
self.connect(self.cancelButton, SIGNAL("clicked()"),
self.reject)
self.buttons.addStretch(1)
Search WWH ::




Custom Search