added backnavigation and qrc
This commit is contained in:
parent
0b9e8fa067
commit
a32fd01e81
15 changed files with 138 additions and 55 deletions
|
|
@ -18,5 +18,27 @@ void NavigationListModel::setModelItems(QList<NavigationItemModel *> list)
|
|||
for(const auto& item : list){
|
||||
mItems.append(item);
|
||||
}
|
||||
|
||||
if(mItems.isEmpty()){
|
||||
mIsBackVisible = false;
|
||||
} else{
|
||||
mIsBackVisible = !list.at(0)->getParentItem()->isRoot();
|
||||
}
|
||||
|
||||
emit modelItemsChanged();
|
||||
}
|
||||
|
||||
bool NavigationListModel::isBackVisible()
|
||||
{
|
||||
return mIsBackVisible;
|
||||
}
|
||||
|
||||
void NavigationListModel::navigateBack()
|
||||
{
|
||||
if(!mIsBackVisible || mItems.isEmpty()) return;
|
||||
|
||||
auto item = qobject_cast<NavigationItemModel*>(mItems.at(0));
|
||||
if(!item || item->getParentItem()->isRoot()) return;
|
||||
|
||||
setModelItems(item->getParentItem()->getSiblings());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue