State:Closed|icon_bug|icon_nuke|database:public|Resolution:Fixed|TargetRelease:12.2v3|BugID:438224|
Problem summary
Adding an item to a QComboBox, after it has been created, cuts off the text in the in the sub-widget (pop-up menu).
Customer reported version
Nuke 12.1v2
Customer reported platform
windows10
Steps to reproduce
1) Open Nuke.
2) Run the following code in the Script Editor:
from PySide2 import QtWidgetsclass TestAddingToComboBox(QtWidgets.QDialog): def __init__(self, parent=None): super(TestAddingToComboBox, self).__init__() mainLayout = QtWidgets.QVBoxLayout() self.com = QtWidgets.QComboBox() mainLayout.addWidget(self.com) self.btn = QtWidgets.QPushButton("Add") self.btn.clicked.connect(self.thing) mainLayout.addWidget(self.btn) ### Pre-added For comparison self.com2 = QtWidgets.QComboBox() self.com2.addItem("aaa_bbb_ccc") self.com2.addItem("aaa_bbb_ccc_ddd_fff_ggg") mainLayout.addWidget(self.com2) self.setLayout(mainLayout) def thing(self): self.com.addItem("aaa_bbb_ccc") self.com.addItem("aaa_bbb_ccc_ddd_fff_ggg_hhh")mainWindow = TestAddingToComboBox()mainWindow.show()
3) In the Window that appears, press the Add button. This will populate the top dropdown menu with a couple of items.
4) Click the top dropdown menu and notice that the longest item/text is cut off at the end:

The bottom dropdown menu is included to show a pre-populated QComboBox that works as expected.
Expected behaviour
Adding an item to a QComboBox, after it has been created, should not cut the text off at the end.
Actual behaviour
Adding an item to a QComboBox, after it has been created, cuts off the text in the in the sub-widget (pop-up menu).
Workaround
Adding the following line (in bold) to the script may resolve the issue:
self.com = QtWidgets.QComboBox()
self.com.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
mainLayout.addWidget(self.com)
Reproduced by support
This bug has been reproduced in:
Nuke 12.1v3 - Windows 10 - Linux CentOS 7 - macOS 10.13 (High Sierra)
Nuke 12.1v1 - Windows 10 - Linux CentOS 7 - macOS 10.13 (High Sierra) - Regression
Unable to reproduce bug in:
Nuke 12.0v6 - Windows 10 - Linux CentOS 7 - macOS 10.13 (High Sierra)
Earliest version tested
Nuke 12.0v6
- This issue doesn't appear in this version and has regressed
We're sorry to hear that
Please tell us why