qtablewidgetitem

Remove unwanted padding/spacing in QTableWidget cells

Remove unwanted padding/spacing in QTableWidget cells Question: I’ve created a QTableWidget and populated its last column with QPushButtons added inside a QButtonGroup (given in the code below): from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import sys class ModTableWidget(QTableWidget): def __init__(self): super().__init__(0, 3) self.setHorizontalHeaderLabels(["Alias", "Path", ""]) self.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeToContents) self.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch) self.horizontalHeader().setSectionResizeMode(2, …

Total answers: 1

Adding images to a QTableWidget in PyQt

Adding images to a QTableWidget in PyQt Question: I’m very new to Python and even newer to PyQt. I’ve managed to create a table, but want to add images in certain cells. I’ve read that I need to subclass the QTableWidget class, or possibly the QTableWidgetItem class and re-implement the QPaintEvent. If anyone has an …

Total answers: 4