Declaring Variable
- 
If you use the qml tag on the right, you get a lot of info from devnet. 
 This one can interest you:
 http://developer.qt.nokia.com/doc/qt-4.7/qdeclarativemodels.html
- 
"Here is a tutorial that uses a string :":http://developer.qt.nokia.com/wiki/Introduction_to_Qt_Quick_for_Cpp_developers#2bbc678dfb658d1ac1f900544fdfd9d8 You can use a similar approch using int. What is it that you don't understand exactly? 
- 
The key is - 
declare your Int or QString like the following : 
 @
 class Foo : public QObject
 {
 Q_OBJECT
 public:
 Q_PROPERTY(int myInt READ myInt WRITE setMyInt)
 Q_PROPERTY(int myString READ myString WRITE setMyString)
 };
 @
- 
Expose your C++ Object to QML : 
 @
 int main(int argc, char *argv[])
 {
 QApplication app(argc, argv);
 QDeclarativeView view;
 Foo foobar;
 view.rootContext()->setContextProperty("myObject", &foobar;);
 view.setSource(QUrl::fromLocalFile("passInt.qml"));
 view.show();
 return app.exec();
 }
 @
- 
Use Exposed Int or String in QML: 
 @ 
 Item {
 width: myObject.myInt
 height: myObject.myInt *2
 }
 @
- 
- 
For completeness, you probably want to use the NOTIFY signal in your Q_PROPERTY declarations. @ 
 public:
 Q_PROPERTY(int myInt READ myInt WRITE setMyInt NOTIFY myIntChanged)
 Q_PROPERTY(int myString READ myString WRITE setMyString NOTIFY myStringChanged)
 @And be sure to emit myIntChanged(value) in setMyInt(), etc. 
