added backnavigation and qrc
This commit is contained in:
parent
0b9e8fa067
commit
a32fd01e81
15 changed files with 138 additions and 55 deletions
|
|
@ -3,9 +3,10 @@
|
|||
#include <QDir>
|
||||
#include <QFile>
|
||||
|
||||
NavigationItemModel::NavigationItemModel(QObject *parent) : QObject(parent)
|
||||
NavigationItemModel::NavigationItemModel(QObject *parent) : QObject(parent),
|
||||
mImageSource("qrc:/default_image"),
|
||||
mParentItem(qobject_cast<NavigationItemModel*>(parent))
|
||||
{
|
||||
///@todo init imageSource with defaul image from qrc
|
||||
}
|
||||
|
||||
QString NavigationItemModel::getImageSource() const
|
||||
|
|
@ -57,7 +58,7 @@ void NavigationItemModel::setCircleDelegate(bool value)
|
|||
|
||||
bool NavigationItemModel::isRoot() const
|
||||
{
|
||||
return mParentItem;
|
||||
return !mParentItem;
|
||||
}
|
||||
|
||||
NavigationItemModel *NavigationItemModel::getParentItem()
|
||||
|
|
@ -75,6 +76,16 @@ QList<NavigationItemModel *> NavigationItemModel::getChildren()
|
|||
return mChildren;
|
||||
}
|
||||
|
||||
QList<NavigationItemModel *> NavigationItemModel::getSiblings()
|
||||
{
|
||||
if(isRoot()){
|
||||
return QList<NavigationItemModel*>();
|
||||
} else{
|
||||
return mParentItem->getChildren();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void NavigationItemModel::appendChild(NavigationItemModel *item)
|
||||
{
|
||||
item->setParent(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue