python - QFormLayout drops the label text when using setItem -
using below code add items qformlayout, nothing displayed , yet no error logs can found.
fl1 = qformlayout() label = qlabel() label.settext("hello") item1 = qwidgetitem(label) fl1.setitem(1, 0, item1) item2 = qwidgetitem(qlineedit()) fl1.setitem(1, 1, item2) fl1.update() fl1.invalidate() per pyqt doc, didn't yet find specific note setitem:
qformlayout.setitem (self, int row, itemrole role, qlayoutitem item)
the item argument has it's ownership transferred qt.
sets item in given row given role item, extending layout empty rows if necessary.
if cell occupied, item not inserted , error message sent console. item spans both columns.
warning: not use function add child layouts or child widget items. use setlayout() or setwidget() instead.
see setlayout().
please share comments appreciated. thanks!
Comments
Post a Comment