Thursday, 5 September 2013

How to implement WPF-like MVVM in Qt/C++/QML?

How to implement WPF-like MVVM in Qt/C++/QML?

I'm writing a proof of concept application, that is very simple. Basically
it's composed of a UI where a list of "Note" type objects is displayed in
a QML ListView.
I then have a few classes which is something along the lines:
#ifndef NOTE_H
#define NOTE_H
#include <string>
using namespace std;
class Note
{
public:
Note(QObject* parent = 0)
: QObject(parent)
{
}
Note(const int id, const string& text)
: _id(id), _text(text)
{
}
int id()
{
return _id;
}
const string text()
{
return _text;
}
void setText(string newText)
{
_text = newText;
}
private:
int _id;
string _text;
};

No comments:

Post a Comment