diff --git a/shared/qt/idian/include/Idian/RowList.hpp b/shared/qt/idian/include/Idian/RowList.hpp index 518e2cef3..44399e9b2 100644 --- a/shared/qt/idian/include/Idian/RowList.hpp +++ b/shared/qt/idian/include/Idian/RowList.hpp @@ -35,6 +35,8 @@ public: void addRow(QWidget *row); void clear(); + int count() const; + private: QWidget *first = nullptr; QWidget *last = nullptr; diff --git a/shared/qt/idian/widgets/RowList.cpp b/shared/qt/idian/widgets/RowList.cpp index fae414e53..887310fe1 100644 --- a/shared/qt/idian/widgets/RowList.cpp +++ b/shared/qt/idian/widgets/RowList.cpp @@ -39,7 +39,7 @@ RowList::RowList(QWidget *parent) : QFrame(parent) void idian::RowList::addHeader(QWidget *widget) { - layout->insertWidget(layout->indexOf(rowLayout) - 1, widget); + layout->insertWidget(layout->indexOf(rowLayout), widget); } // Note: This function takes ownership of the added widget @@ -48,7 +48,7 @@ void idian::RowList::addHeader(QWidget *widget) void RowList::addRow(QWidget *widget) { // Add custom spacer when more than one row exists - if (rowLayout->count() > 0) { + if (count() > 0) { rowLayout->addWidget(new RowListSpacer(this)); } @@ -88,3 +88,8 @@ void RowList::clear() adjustSize(); } + +int idian::RowList::count() const +{ + return rowLayout->count(); +}