hi,all, I'm not sure it is appropriated to post this general question here, it not, please give me reminder.
I want to add progressbar into table widget with QStyleItemDelegate, it show progressbar on specific column, but the the progressbar does not fill full width of column. I also attached the screenshot to this mail. following is my code snippet. class CProgressBarDeletgate(QtGui.QStyledItemDelegate): def paint(self, painter, optionViewItem, modelIndex): progress_value = int(str(str(modelIndex.data().toPyObject()))) progressBarOption = QtGui.QStyleOptionProgressBar() progressBarOption.rect = optionViewItem.rect progressBarOption.minimum = 0 progressBarOption.maximum = 100 progressBarOption.progress = progress_value progressBarOption.state = QtGui.QStyle.State_Enabled progressBarOption.textVisible = True QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_ProgressBar, progressBarOption, painter) def __init__(self, parent=None): super(CProgressBarDeletgate, self).__init__(parent) following is tablewidget initialization code: self._ui.tableWidget.setColumnCount(2) self._ui.tableWidget.setHorizontalHeaderLabels(['FileName','Progress']) self._ui.tableWidget.setItemDelegateForColumn(1, CProgressBarDeletgate()) #self._ui.tableWidget.verticalHeader().setDefaultSectionSize() default_height = self._ui.tableWidget.verticalHeader().defaultSectionSize() self._ui.tableWidget.verticalHeader().setDefaultSectionSize(default_height - 10) Thank you so much~! -- ------------ best regards Wang Qi
<<attachment: progessbar_in_tablewidget.png>>
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt