You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
793 B
41 lines
793 B
#include "drawerviewmodel.h"
|
|
#include <QtMvvmCore/SettingsViewModel>
|
|
|
|
#include "sampleviewmodel.h"
|
|
#include "tabviewmodel.h"
|
|
|
|
DrawerViewModel::DrawerViewModel(QObject *parent) :
|
|
ViewModel(parent),
|
|
_navModel(new QStandardItemModel(0, 1, this))
|
|
{
|
|
_navModel->appendRow(new QStandardItem(tr("Main Sample")));
|
|
_navModel->appendRow(new QStandardItem(tr("Tab Sample")));
|
|
_navModel->appendRow(new QStandardItem(tr("Settings")));
|
|
}
|
|
|
|
DrawerViewModel::~DrawerViewModel()
|
|
{
|
|
qInfo(Q_FUNC_INFO);
|
|
}
|
|
|
|
QStandardItemModel *DrawerViewModel::navModel() const
|
|
{
|
|
return _navModel;
|
|
}
|
|
|
|
void DrawerViewModel::open(int index)
|
|
{
|
|
switch (index) {
|
|
case 0:
|
|
show<SampleViewModel>();
|
|
break;
|
|
case 1:
|
|
show<TabViewModel>();
|
|
break;
|
|
case 2:
|
|
show<QtMvvm::SettingsViewModel>();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|