[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: |
Gustavo de Sá Carvalho Honorato |
Subject: |
Re: [Libqtlua-list] Accessing QObject inside a property in Lua |
Date: |
Mon, 24 Jan 2011 17:11:02 -0200 |
2011/1/21 Alexandre Becoulet <address@hidden>:
> On Tuesday, January 18, 2011 01:16:09 pm you wrote:
>> 2011/1/17 Gustavo de Sá Carvalho Honorato <address@hidden>:
>> > 2011/1/17 Alexandre Becoulet <address@hidden>:
>> >> On Monday, January 17, 2011 07:39:37 pm you wrote:
>> >>
>> >> Hi,
>> >>
>> >>> >> > I guessed that. The problem is once registered as a Qt meta type,
>> >>> >> > MainWindow* and QObject* are just different meta types. Qt meta
>> >>> >> > types system does not enable QtLua to guess at runtime that
>> >>> >> > MainWindow* can be interpreted as a QObject*, due to C++
>> >>> >> > inheritance rules.
>> >>
>> >> I found no way to even detect if the type is a pointer to a QObject or
>> >> if its an array of floats or anything else from the registered meta
>> >> type id. QMetaType is not designed to return a pointer to the
>> >> QMetaObject when relevant. Any idea?
>> >
>> > Ok, I think I misunderstood the problem. The problem is to retrieve
>> > the QMetaObject from an metatype id. I'll try to think in something.
>>
>> I haven't had time to check this, but I was thinking in how
>> QScriptEngine solve this problem. Do you know if QScriptEngine can do
>> this conversions? If yes, our answer should be inside the
>> QScriptEngine source code.
>
> Didn't checked that yet, but you are right, QScriptEngine is the right place
> to dig.
Have you tried qVariantCanConvert<QObject*>() ? It seems to be what we
are looking for.
>
> In the mean time you can register pointers to QObject based classes with two
> lines of code as shown on the example. This should be a minor issue unless you
> plan to register a lot of such pointer types. What do you think?
>
> --
> Alexandre
>
>
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, (continued)
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Alexandre Becoulet, 2011/01/11
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Gustavo de Sá Carvalho Honorato, 2011/01/11
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Alexandre Becoulet, 2011/01/12
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Gustavo de Sá Carvalho Honorato, 2011/01/14
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Alexandre Becoulet, 2011/01/16
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Gustavo de Sá Carvalho Honorato, 2011/01/17
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Alexandre Becoulet, 2011/01/17
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Gustavo de Sá Carvalho Honorato, 2011/01/17
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Gustavo de Sá Carvalho Honorato, 2011/01/18
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Alexandre Becoulet, 2011/01/21
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua,
Gustavo de Sá Carvalho Honorato <=
- Re: [Libqtlua-list] Accessing QObject inside a property in Lua, Gustavo de Sá Carvalho Honorato, 2011/01/24