diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2016-04-11 10:17:23 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2016-04-14 22:12:59 +0000 |
commit | 8fbae648db3bc51bafacfe1f88e40561d357e60a (patch) | |
tree | f249c6883d243c3ada39d3648b124fb348b40cf2 /src/widgets/kernel/qformlayout.h | |
parent | ffde99d5a0ae5d3d4654af7ceda38f8a8dd7fdb9 (diff) |
Implement QFormLayout row removal
QFormLayout currently allows to remove a row only through takeAt, which
doesn't resize the internal structure used to store the layout-related
data. The implementation of rowCount uses that structure so it returns
a row count that doesn't match what the user sees.
The removeRow methods complement that be doing a "real" removal which
will also keep the row count in sync.
[ChangeLog][QtWidgets][QFormLayout] Added removeRow(), takeRow().
Task-number: QTBUG-15990
Change-Id: I204b219a837887e4bf95d1bc77407f1c53ae9819
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/kernel/qformlayout.h')
-rw-r--r-- | src/widgets/kernel/qformlayout.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h index 8e4f7b7309..ca15ec6f9a 100644 --- a/src/widgets/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -80,6 +80,11 @@ public: }; Q_ENUM(ItemRole) + struct TakeRowResult { + QLayoutItem *labelItem; + QLayoutItem *fieldItem; + }; + explicit QFormLayout(QWidget *parent = Q_NULLPTR); ~QFormLayout(); @@ -114,6 +119,14 @@ public: void insertRow(int row, QWidget *widget); void insertRow(int row, QLayout *layout); + void removeRow(int row); + void removeRow(QWidget *widget); + void removeRow(QLayout *layout); + + TakeRowResult takeRow(int row); + TakeRowResult takeRow(QWidget *widget); + TakeRowResult takeRow(QLayout *layout); + void setItem(int row, ItemRole role, QLayoutItem *item); void setWidget(int row, ItemRole role, QWidget *widget); void setLayout(int row, ItemRole role, QLayout *layout); @@ -153,6 +166,8 @@ private: void resetFormAlignment(); }; +Q_DECLARE_TYPEINFO(QFormLayout::TakeRowResult, Q_PRIMITIVE_TYPE); + QT_END_NAMESPACE #endif |