Commit 2bc9dda1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Try to use new model

parent 852f0701
......@@ -42,6 +42,19 @@ QHash<int, QByteArray> AddressBookListViewModel::roleNames() const
QVariant AddressBookListViewModel::data(const QModelIndex &index, int role) const
{
if (index.row() < 0) {
return QVariant();
}
//TODO
if (role == AddressEmail) {
return {};
} else if (role == AddressName) {
return {};
} else if (role == AddressSection) {
return {};
} else if (role == AddressIcon) {
return {};
}
//TODO
#if 0
if (index.row() < 0 || index.row() >= mListAddressBook.count()) {
......
......@@ -27,9 +27,10 @@ AddressBookQuickWidget::AddressBookQuickWidget(QWidget *parent)
{
resize(400, 500);
setResizeMode(QQuickWidget::SizeRootObjectToView);
mAddressBookModel = new AddressBookListViewModel(this);
QQmlContext *ctxt = rootContext();
//TODOctxt->setContextProperty("addressModel", sortProxy/*mModel*/);
ctxt->setContextProperty(QStringLiteral("addressModel"), mAddressBookModel);
}
AddressBookQuickWidget::~AddressBookQuickWidget()
......@@ -41,3 +42,8 @@ void AddressBookQuickWidget::loadQmlFile(const QString &qmlFilePath)
{
setSource(QUrl(qmlFilePath));
}
AddressBookListViewModel *AddressBookQuickWidget::addressBookModel() const
{
return mAddressBookModel;
}
......@@ -21,7 +21,7 @@
#define ADDRESSBOOKQUICKWIDGET_H
#include <QQuickWidget>
class AddressBookListViewModel;
class AddressBookQuickWidget : public QQuickWidget
{
Q_OBJECT
......@@ -30,6 +30,11 @@ public:
~AddressBookQuickWidget();
void loadQmlFile(const QString &qmlFilePath);
AddressBookListViewModel *addressBookModel() const;
private:
AddressBookListViewModel *mAddressBookModel;
};
#endif // ADDRESSBOOKQUICKWIDGET_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment