Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

GUI Add/delete row button for table widget



  • Hi, I have a code for a GUI that has a table widget, and I'm trying to add buttons that can add and delete a row for that table. Does anyone know how to do this? Here is the code below:

    ChemistryDataTable = QtWidgets.QTableWidget()
    ChemistryDataTable.setRowCount(6)
    ChemistryDataTable.setColumnCount(5)
    ChemistryDataTable.setHorizontalHeaderLabels(["Name", "wt (%)", "T (K)","H (cals/mol)","Xi"])
    for i in range(6):
    for j in range(5):
    ChemistryDataTable.setItem(i,j,QtWidgets.QTableWidgetItem())
    layout = QtWidgets.QHBoxLayout()
    layout.addWidget(ChemistryDataTable)
    tab_layout.addLayout(layout)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Where exactly do you store them ?


Log in to reply