Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-07 Thread Николай Шатохин
I surprised that guy named Vladimir doesn't know Russian :) Unfortunatelly, I can't go to DevDays :( 2013/10/7 Vladimir M. > Hey, stop sending those cryptic messages! Not everyone understands Russin > here!! :) > Fact is, sometimes it's indeed easier to ask, with QML. > And QML needs a better s

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-07 Thread Vladimir M.
Hey, stop sending those cryptic messages! Not everyone understands Russin here!! :) Fact is, sometimes it's indeed easier to ask, with QML. And QML needs a better set of guides on C++ integration, also (btw, if anyone currently reading this is at DevDays these days, you can find me at ICS booth --

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-07 Thread mrqtros
Дружище, ты меня прости, что я по-русски тебе отвечу, но ты не желаешь пробовать, прежде чем спрашивать? Или просто документацию посмотреть? А то это спам какой-то уже! Best regards, Roman. 07.10.13 13:12 Николай Шатохин написал(а): Can I use QList of pointers? And get objects in QML. 201

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-07 Thread Alberto Mardegan
On 10/07/2013 12:12 PM, Николай Шатохин wrote: > Can I use QList of pointers? And get objects in QML. Yes, see QQmlListProperty: http://qt-project.org/doc/qt-5.0/qtqml/qqmllistproperty.html Ciao, Alberto -- Mailing list: https://launchpad.net/~ubuntu-phone Post to : ubuntu-phone@lists.l

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-07 Thread Николай Шатохин
Can I use QList of pointers? And get objects in QML. 2013/10/7 Николай Шатохин > Can I use QList (or something similar) as Q_PROPERTY? How can I use it in > QML? > > Best regards, > Nick > > > 2013/10/2 Vladimir M. > > CONSTANT (or whatever the name is) helps here as well -- if the prop does >

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-07 Thread Николай Шатохин
Can I use QList (or something similar) as Q_PROPERTY? How can I use it in QML? Best regards, Nick 2013/10/2 Vladimir M. > CONSTANT (or whatever the name is) helps here as well -- if the prop does > not change :) > > > On Wed, Oct 2, 2013 at 7:58 PM, Николай Шатохин wrote: > >> Hm, yes, it hel

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Vladimir M.
CONSTANT (or whatever the name is) helps here as well -- if the prop does not change :) On Wed, Oct 2, 2013 at 7:58 PM, Николай Шатохин wrote: > Hm, yes, it helps. Thank you. > > > 2013/10/2 Roman Shchekin > >> You should register Game via qmlRegisterType too. >> >> Your Engine's "game" proper

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Николай Шатохин
Hm, yes, it helps. Thank you. 2013/10/2 Roman Shchekin > You should register Game via qmlRegisterType too. > > Your Engine's "game" property used in binding and it has no NOTIFY signal. > I hope you know what is it. If no - you should learn basics of Qt first. > > Cheers, > Roman. > > > 2013/10

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Николай Шатохин
But game property is a pointer. I don't think that it will change its address in runtime. 2013/10/2 Roman Shchekin > You should register Game via qmlRegisterType too. > > Your Engine's "game" property used in binding and it has no NOTIFY signal. > I hope you know what is it. If no - you should

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Roman Shchekin
You should register Game via qmlRegisterType too. Your Engine's "game" property used in binding and it has no NOTIFY signal. I hope you know what is it. If no - you should learn basics of Qt first. Cheers, Roman. 2013/10/2 Николай Шатохин > I did it, but now I got: > > QMetaProperty::read: Un

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Николай Шатохин
I did it, but now I got: QMetaProperty::read: Unable to handle unregistered datatype 'Game*' for property 'Engine::game' QQmlExpression: Expression qrc:/Reactor.qml:7 depends on non-NOTIFYable properties: Engine::game On application startup (game is Q_PROPERY of Engine and has type Game *). 2

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Николай Шатохин
So, I can do this: Q_PROPERTY(Hull * hull READ hull) Q_PROPERTY(Reactor * reactor READ reactor) Q_PROPERTY(Shields * shields READ shields) Am I right? If star will be deprecated, what will we must to use instead it? 2013/10/2 Vladimir M. > Just put the star in the property decl -- it's the s

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Vladimir M.
Just put the star in the property decl -- it's the stock way to do it, and the decl w/o star will be deprecated probably soon, as far as I know. Then, bind to the props in qml, and that's it! 02 окт. 2013 г. 14:31 пользователь "Николай Шатохин" написал: > > Ok, I registered as Type class Ship inh

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-10-02 Thread Николай Шатохин
Ok, I registered as Type class Ship inherited from QObject that have fields: Q_PROPERTY(Hull hull READ hull) Q_PROPERTY(Reactor reactor READ reactor) Q_PROPERTY(Shields shields READ shields) (all field classes inherited from QObject too) But in ship class I'm using this fields as pointers (Hull

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Vladimir M.
Sure, you can always wire as many objects as possible to smth existing in a scene or set as a context property -- it's a simple Q_PROPERTY assignment on the C++ side, with a pointer passed to the setter (and works as soon as you declare the property on the QML side (or register and instantiate a C+

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
What if I will create property backend in QML type and then I will set this property in all QML objects to global object? So, theoretically this can solve my problem. 2013/9/30 Vladimir M. > Then, it looks like the standard way would be to have an instance of the > item embedded in each page in

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Vladimir M.
Then, it looks like the standard way would be to have an instance of the item embedded in each page in the stack. If this turns out to be too resource consuming, you may try to play some tricks like removing it from all the pages and overlaying over the whole stack (if the item will always be in t

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
I need to have this object in different qml files (for i.e. GameChat must be shown on GameCreation,Game,GameResults pages: this it differents QML files and differents pages in PageStack), but I created only one QtQuickView in main.cpp. So, do view is qml file or QtQuckView object? 2013/9/30 Vladi

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Vladimir M.
You probably can't share a single instance of a QML visual item between views, but as soon as you have the type registered properly / importable / etc, you can use instantiate it in as many views as you like. A QObject pointer can be passed around to items living in different veiws inside the same

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
What if I need to show the same QML object in two different places? How to do this? How to create new QML object without recreating it in C++? 2013/9/30 Николай Шатохин > 0_o. I didn't know that all objects in QML are global. Thank you very much. > > > 2013/9/30 > > Omg declare global engine

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
0_o. I didn't know that all objects in QML are global. Thank you very much. 2013/9/30 > Omg declare global engine object in main qml file and that's all > > 30.09.13 13:19 Николай Шатохин написал(а): > I'm using qmlRegisterType now. I have problems, because two QML objects in > different QML fi

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread mrqtros
Omg declare global engine object in main qml file and that's all 30.09.13 13:19 Николай Шатохин написал(а): I'm using qmlRegisterType now. I have problems, because two QML objects in different QML files it is two different objects in C++. I registered as type class that have static object of E

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Michael Zanetti
On Monday 30 September 2013 12:19:05 Николай Шатохин wrote: > I'm using qmlRegisterType now. I have problems, because two QML objects in > different QML files it is two different objects in C++. I registered as > type class that have static object of Engine, but now I have butthurt with > it (I nee

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
I'm using qmlRegisterType now. I have problems, because two QML objects in different QML files it is two different objects in C++. I registered as type class that have static object of Engine, but now I have butthurt with it (I need retranslate all signals, getters and setters) 2013/9/30 Michael

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Michael Zanetti
On Monday 30 September 2013 12:05:03 Николай Шатохин wrote: > Can I set only one object as context property that contains other objects > (and this objects contain objects too) and get this deep objects in QML? > > For i.e. I have object of class Engine that has object of class Game, Game > contai

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
Can I set only one object as context property that contains other objects (and this objects contain objects too) and get this deep objects in QML? For i.e. I have object of class Engine that has object of class Game, Game contains object of Ship and Ship contains object of Reactor. So, I set objec

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-30 Thread Николай Шатохин
I've already found this solution: http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-contextproperties.html It helps. Thanks. 2013/9/30 Michael Zanetti > On Sunday 29 September 2013 13:45:01 Vladimir M. wrote: > > Sounds like a "context property" use case (you plain set a QObject as a

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-29 Thread Michael Zanetti
On Sunday 29 September 2013 13:45:01 Vladimir M. wrote: > Sounds like a "context property" use case (you plain set a QObject as a > context property for a view's root scope, w/o even registering the object's > type, and all its properties and invokables become available). I don't recommend using c

Re: [Ubuntu-phone] Create QML view for C++ object (not class)

2013-09-29 Thread Vladimir M.
Sounds like a "context property" use case (you plain set a QObject as a context property for a view's root scope, w/o even registering the object's type, and all its properties and invokables become available). On Sun, Sep 29, 2013 at 6:38 AM, Николай Шатохин wrote: > Hello. > > When I create a