Fix inserting items in the list when there's hidden items
This commit is contained in:
@@ -394,7 +394,7 @@ void Item::insertItem(Item *item, Location loc, DefaultSizeMode defaultSizeMode,
|
||||
|
||||
if (m_parent->hasOrientationFor(loc)) {
|
||||
const bool locIsSide1 = locationIsSide1(loc);
|
||||
int indexInParent = m_parent->indexOfVisibleChild(this);
|
||||
int indexInParent = m_parent->childItems().indexOf(this);
|
||||
if (!locIsSide1)
|
||||
indexInParent++;
|
||||
|
||||
@@ -1015,6 +1015,11 @@ int ItemContainer::indexOfVisibleChild(const Item *item) const
|
||||
return items.indexOf(const_cast<Item*>(item));
|
||||
}
|
||||
|
||||
const Item::List ItemContainer::childItems() const
|
||||
{
|
||||
return m_children;
|
||||
}
|
||||
|
||||
void ItemContainer::removeItem(Item *item, bool hardRemove)
|
||||
{
|
||||
Q_ASSERT(!item->isRoot());
|
||||
|
||||
@@ -442,6 +442,8 @@ public:
|
||||
bool hasChildren() const;
|
||||
bool hasVisibleChildren(bool excludeBeingInserted = false) const;
|
||||
int indexOfVisibleChild(const Item *) const;
|
||||
const List childItems() const;
|
||||
|
||||
void removeItem(Item *, bool hardRemove = true);
|
||||
bool isEmpty() const;
|
||||
void setGeometry_recursive(QRect rect) override;
|
||||
|
||||
Reference in New Issue
Block a user