[ create a new paste ] login | about

Link: http://codepad.org/G08fg6Tp    [ raw code | output | fork ]

C++, pasted on Apr 18:
//userprofile.h
#include <QObject>
#include <QUrl>

namespace SailReads
{
	class UserProfile : public QObject
	{
		Q_OBJECT

		QUrl ProfileImageUrl_;

		Q_PROPERTY (QUrl userImage READ getUserImage WRITE setUserImage)
	public:
		explicit UserProfile(QObject *parent = 0);

		QUrl getUserImage () const;
		void setUserImage (const QUrl& url);
	};
}

//userprofile.cpp
#include "userprofile.h"

namespace SailReads
{
	UserProfile::UserProfile (QObject *parent)
	: QObject (parent)
	{
	}

	QUrl UserProfile::getUserImage () const
	{
		return ProfileImageUrl_;
	}

	void UserProfile::setUserImage (const QUrl& url)
	{
		ProfileImageUrl_ = url;
	}
}

//sailreadsmanager.cpp
...
void SailreadsManager::handleGotUserProfile (UserProfile *profile)
	{
		QMetaObject::invokeMethod (MainView_->rootObject (),
				"setUserProfile",
				Q_ARG (QVariant, QVariant::fromValue (profile)));
	}
...

harbour-sailreads.qml
ApplicationWindow
{
    id: mainWindow
...
    function setUserProfile (profile) {
        console.log (profile)
        console.log (profile.userImage)
    }
...
}


Output:
1
2
3
4
5
Line 18: error: QObject: No such file or directory
Line 15: error: QUrl: No such file or directory
Line 24: error: userprofile.h: No such file or directory
Line 8: error: expected class-name before '{' token
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: