QTableView: openPersistentEditor doesn't resize
-
Hello,
I'm finding that editors opened with openPersistentEditors do not resize until the resize action has stopped.Here's my code:
from PySide2 import QtCore, QtGui, QtWidgets class Delegate(QtWidgets.QStyledItemDelegate): def createEditor(self, parent, option, index): editor = QtWidgets.QComboBox(parent) editor.addItems(map(str, range(5))) return editor class Main(QtWidgets.QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.tableview = QtWidgets.QTableView() self.model = QtGui.QStandardItemModel() self.tableview.setModel(self.model) self.setLayout(QtWidgets.QVBoxLayout()) self.layout().addWidget(self.tableview) items = [] for i in range(5): item = QtGui.QStandardItem() items.append(item) self.model.appendRow(items) self.tableview.setItemDelegateForColumn(1, Delegate(self)) self.tableview.openPersistentEditor(self.model.index(0, 1)) if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) main = Main() main.show() sys.exit(app.exec_())
And here's a screenshot of what the combobox looks like when resizing the columns.
I kept the example code as simple as possible, is there anything I'm missing?
Thanks,
Beat -
@beatreichenbach I do not reproduce the problem, try adding
app.setStyle("fusion")
-
That didn't fix the issue itself. I appended another gif of the issue. This happens both in "standalone" Qt and in a dcc such as maya.
-
@beatreichenbach okay, that's not the error you were describing. Now with the .gif the error is better understood.
what is your PySide2 version?
-
I'm using the latest PySide2 package available through pip: https://pypi.org/project/PySide2 which is currently PySide2 5.15.2.