change the position of buttons in a QHBoxLayout
-
I want to change th position of "+" , "Verify" and "Correct" buttons to the top ( next to the headers of the table) . Here is my code :def SpecForm(self): spec = QDialog(self) spec.setWindowTitle('Spécifications du Client') spec.resize(800, 600) main_layout = QHBoxLayout(spec) self.table = QTableWidget(0, 3) self.table.verticalHeader().setVisible(False) self.table.setHorizontalHeaderLabels(['Object', 'User/Group', 'r w x']) self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) main_layout.addWidget(self.table) add_row_button = QPushButton('+') add_row_button.setStyleSheet(""" QPushButton { border-radius: 15px; background-color: blue; color: white; font-size: 16px; padding: 0px; } QPushButton:hover { background-color: navy; } QPushButton:pressed { background-color: darkblue; } """) add_row_button.clicked.connect(self.add_table_row) main_layout.addWidget(add_row_button) submit_button = QPushButton('Verify') submit_button.clicked.connect(self.validate_spec) main_layout.addWidget(submit_button) corr_button = QPushButton('Correct') main_layout.addWidget(corr_button) spec.setLayout(main_layout) spec.exec_()
Can anyone help me ?
-