diff options
-rw-r--r-- | plugingui/humanizerframecontent.h | 2 | ||||
-rw-r--r-- | plugingui/layout.cc | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/plugingui/humanizerframecontent.h b/plugingui/humanizerframecontent.h index ddbcf6a..530742b 100644 --- a/plugingui/humanizerframecontent.h +++ b/plugingui/humanizerframecontent.h @@ -53,8 +53,8 @@ public: layout.addItem(control); } +private: VBoxLayout layout{this}; - Label caption{this}; }; diff --git a/plugingui/layout.cc b/plugingui/layout.cc index 551611c..ea025bd 100644 --- a/plugingui/layout.cc +++ b/plugingui/layout.cc @@ -70,7 +70,9 @@ void Layout::addItem(LayoutItem* item) void Layout::removeItem(LayoutItem* item) { - std::remove(items.begin(), items.end(), item); + auto new_end = std::remove(items.begin(), items.end(), item); + items.erase(new_end, items.end()); + layout(); } @@ -118,6 +120,7 @@ void VBoxLayout::layout() while(i != items.end()) { LayoutItem* item = *i; + if(resizeChildren) { auto num_items = items.size(); @@ -247,11 +250,10 @@ GridLayout::GridLayout(LayoutItem* parent, std::size_t number_of_columns, void GridLayout::removeItem(LayoutItem* item) { - Layout::removeItem(item); - // manually remove from grid_ranges as remove_if doesn't work on an - // unordered_map - for(auto it = grid_ranges.begin(); it != grid_ranges.end(); ++it) + // unordered_map. + auto it = grid_ranges.begin(); + while(it != grid_ranges.end()) { if(it->first == item) { @@ -262,6 +264,8 @@ void GridLayout::removeItem(LayoutItem* item) ++it; } } + + Layout::removeItem(item); } void GridLayout::layout() |