PyQt5 - QPushButton to add row to a QTableView
Moved
Unsolved
Qt for Python
-
-
You can implement 'add row to QTableView' action for button in that way:
from PyQt5.QtGui import QStandardItemModel, QStandardItem ... table = QTableView(...) table.setModel(QStandardtemModel()) addRowButton = QPushButton('Add row', ...) addRowButton.clicked.connect(lambda: table.model().insertRow(0, [QStandardItem('1'), QStandardItem('example'), ...])