Skip to content

Commit 4428fc2

Browse files
Update main.py
Fixed the signal handling. Fixed the enum members to their fully qualified names.
1 parent 946320e commit 4428fc2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/02 PyQt Widgets/main.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, parent=None):
7373
self.createBottomRightGroupBox()
7474
self.createProgressBar()
7575

76-
styleComboBox.activated[str].connect(self.changeStyle)
76+
styleComboBox.textActivated.connect(self.changeStyle)
7777
self.useStylePaletteCheckBox.toggled.connect(self.changePalette)
7878
disableWidgetsCheckBox.toggled.connect(self.topLeftGroupBox.setDisabled)
7979
disableWidgetsCheckBox.toggled.connect(self.topRightGroupBox.setDisabled)
@@ -128,15 +128,15 @@ def createTopLeftGroupBox(self):
128128

129129
checkBox = QCheckBox("Tri-state check box")
130130
checkBox.setTristate(True)
131-
checkBox.setCheckState(Qt.PartiallyChecked)
131+
checkBox.setCheckState(Qt.CheckState.PartiallyChecked)
132132

133133
layout = QVBoxLayout()
134134
layout.addWidget(radioButton1)
135135
layout.addWidget(radioButton2)
136136
layout.addWidget(radioButton3)
137137
layout.addWidget(checkBox)
138138
layout.addStretch(1)
139-
self.topLeftGroupBox.setLayout(layout)
139+
self.topLeftGroupBox.setLayout(layout)
140140

141141
def createTopRightGroupBox(self):
142142
self.topRightGroupBox = QGroupBox("Group 2")
@@ -160,8 +160,8 @@ def createTopRightGroupBox(self):
160160

161161
def createBottomLeftTabWidget(self):
162162
self.bottomLeftTabWidget = QTabWidget()
163-
self.bottomLeftTabWidget.setSizePolicy(QSizePolicy.Preferred,
164-
QSizePolicy.Ignored)
163+
self.bottomLeftTabWidget.setSizePolicy(QSizePolicy.Policy.Preferred,
164+
QSizePolicy.Policy.Ignored)
165165

166166
tab1 = QWidget()
167167
tableWidget = QTableWidget(10, 10)
@@ -195,18 +195,18 @@ def createBottomRightGroupBox(self):
195195
self.bottomRightGroupBox.setChecked(True)
196196

197197
lineEdit = QLineEdit('s3cRe7')
198-
lineEdit.setEchoMode(QLineEdit.Password)
198+
lineEdit.setEchoMode(QLineEdit.EchoMode.Password)
199199

200200
spinBox = QSpinBox(self.bottomRightGroupBox)
201201
spinBox.setValue(50)
202202

203203
dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
204204
dateTimeEdit.setDateTime(QDateTime.currentDateTime())
205205

206-
slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
206+
slider = QSlider(Qt.Orientation.Horizontal, self.bottomRightGroupBox)
207207
slider.setValue(40)
208208

209-
scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
209+
scrollBar = QScrollBar(Qt.Orientation.Horizontal, self.bottomRightGroupBox)
210210
scrollBar.setValue(60)
211211

212212
dial = QDial(self.bottomRightGroupBox)
@@ -240,4 +240,4 @@ def createProgressBar(self):
240240
app = QApplication(sys.argv)
241241
gallery = WidgetGallery()
242242
gallery.show()
243-
sys.exit(app.exec())
243+
sys.exit(app.exec())

0 commit comments

Comments
 (0)