Unsolved QFormLayout clear
-
How can I clear a QFormLayout?
I have tried (Python):
for row in reversed(xrange(self.count())): item = self.takeAt(row) item.widget().deleteLater()
This looks like it is cleared visually, but rowCount() remains the same.
-
I think it's a bug...
https://bugreports.qt.io/browse/QTBUG-15990
Just annoying that it seems like no one wants to fix it.
-
Is there any way to create my own QFormLayout class with the option to remove rows? I've gotten pretty close so far by making a class that inherits from QVBoxLayout, then every time a row is added, I create a QHBoxLayout with a label and field in it. The only problem I'm having is having all of the fields align to the longest label.
-
Hi,
You can build Qt yourself and apply the patch proposed through the bug report if you're in a hurry.
-
@elveatles How about a QGridLayout with 2 columns then (label and widget)? The columns would take care of proper alignment.
-
@Chris-Kawa I've discovered that QGridLayout has the same issue.