diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 26292c056b38..4a175e34f676 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -481,6 +481,7 @@ def setFields(self, obj): item.setData(self.DataObjectSub, sub) self.form.baseList.addItem(item) self.form.baseList.blockSignals(False) + self.resizeBaseList() def itemActivated(self): FreeCADGui.Selection.clearSelection() @@ -566,6 +567,7 @@ def deleteBase(self): self.setDirty() self.updateBase() self.updatePanelVisibility('Operation', self.obj) + self.resizeBaseList() def updateBase(self): newlist = [] @@ -586,6 +588,7 @@ def clearBase(self): self.obj.Base = [] self.setDirty() self.updatePanelVisibility('Operation', self.obj) + self.resizeBaseList() def importBaseGeometry(self): opLabel = str(self.form.geometryImportList.currentText()) @@ -615,6 +618,15 @@ def updateSelection(self, obj, sel): else: self.form.addBase.setEnabled(False) + def resizeBaseList(self): + # Set base geometry list window to resize based on contents + # Code reference: + # https://stackoverflow.com/questions/6337589/qlistwidget-adjust-size-to-content + qList = self.form.baseList + # qList.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + col = qList.width() # 300 + row = (qList.count() + qList.frameWidth()) * 15 + qList.setFixedSize(col, row) class TaskPanelBaseLocationPage(TaskPanelPage): '''Page controller for base locations. Uses PathGetPoint.'''