From MAILER-DAEMON Tue Jan 04 07:49:14 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Pa6KA-0006Yq-5X
	for mharc-libqtlua-list@gnu.org; Tue, 04 Jan 2011 07:49:14 -0500
Received: from [140.186.70.92] (port=45933 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Pa6K8-0006XI-6C
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 07:49:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pa6K6-0001Fs-W4
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 07:49:11 -0500
Received: from mail-yx0-f195.google.com ([209.85.213.195]:37321)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pa6K6-0001Fd-Tc
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 07:49:10 -0500
Received: by yxk30 with SMTP id 30so2750214yxk.10
	for <libqtlua-list@nongnu.org>; Tue, 04 Jan 2011 04:49:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:date:message-id
	:subject:from:to:content-type;
	bh=EEsOHfnc/XHPI75HEnSMfRlNUNlBg3Bexe3Xow1gJ7A=;
	b=c7X472NVimDLuCE3ryDIKYUczD6kMgT2FJQ+QWvVeQgGjdv0f9ER7evPf7AaAzrbZ9
	GJ0K6g7YmIQN1xhLgoXl7vahXWOukS1W8gW93AwxA7CgOiUuAq1MSOGu6DecoQj6pcVz
	BLaqsHRo1s42sBePc14F4C3mAQmV9hTL5nyWs=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=c/W9jasVX0RrI8dHdGwzlaUWLEPWL1CVjrI7W8750vAPySQX98wWkjyTobTX0HqVJ8
	KsrZGuV7WP6pwxDK074XdASiuVL1lb1QLCXVLD/tnwdf7x/mrPVMlxLEeSTkncpCTui9
	7h6LpC81dc1CKFhZ66d9oIul3+LIyujPLNQeQ=
MIME-Version: 1.0
Received: by 10.150.191.14 with SMTP id o14mr19840577ybf.344.1294145350001;
	Tue, 04 Jan 2011 04:49:10 -0800 (PST)
Received: by 10.150.50.14 with HTTP; Tue, 4 Jan 2011 04:49:09 -0800 (PST)
Date: Tue, 4 Jan 2011 10:49:09 -0200
Message-ID: <AANLkTi=R8adf53Hu5yVD73YF3Ow7zrRStXLo+ehLyhGf@mail.gmail.com>
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: libqtlua-list@nongnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [Libqtlua-list] Project maintenance
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Jan 2011 12:49:13 -0000

Hi,

I saw in the project's site that QtLua is tested against Qt 4.5, which
is quite old. This project is currently active?

Thanks,
Gustavo


From MAILER-DAEMON Tue Jan 04 13:52:52 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PaC04-0004aD-1E
	for mharc-libqtlua-list@gnu.org; Tue, 04 Jan 2011 13:52:52 -0500
Received: from [140.186.70.92] (port=52944 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PaBzb-0004OV-Nj
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 13:52:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PaBzC-0008Hs-M9
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 13:52:23 -0500
Received: from services.ssji.net ([91.121.51.80]:56486)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PaBzC-0008HJ-Hi
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 13:51:58 -0500
Received: from [2001:41d0:2:b2a6::51:80] (helo=services.ssji.net)
	by services.ssji.net with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.72) (envelope-from <alexandre.becoulet@free.fr>)
	id 1PaByF-0001gm-H8
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 19:50:59 +0100
Received: from [2a01:e35:8b77:8030:72f1:a1ff:fe91:4e07] (helo=alcor.localnet)
	by services.ssji.net with esmtpsa
	(TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PaByF-0001gi-97
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 19:50:59 +0100
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: libqtlua-list@nongnu.org
Subject: Re: [Libqtlua-list] Project maintenance
Date: Tue, 4 Jan 2011 19:51:57 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.4; x86_64; ; )
References: <AANLkTi=R8adf53Hu5yVD73YF3Ow7zrRStXLo+ehLyhGf@mail.gmail.com>
In-Reply-To: <AANLkTi=R8adf53Hu5yVD73YF3Ow7zrRStXLo+ehLyhGf@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201101041951.58320.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Jan 2011 18:52:51 -0000

On Tuesday, January 04, 2011 01:49:09 pm Gustavo de S=E1 Carvalho Honorato =
wrote:

Hi,

> I saw in the project's site that QtLua is tested against Qt 4.5, which
> is quite old. This project is currently active?

I'am using this project and add new features as needed for my use.
The library is in a stable state. I'am currently using QtLua 1.2.1 with
Qt 4.7.1. You are right, I have to update the Qt version on the website.

Note that QtLua code does not need update on new Qt4 release as it's
not a binding. It relies on Qt meta-object system to list QObjects
members at run-time and it doesn't aim at wrapping the whole Qt API.

I'am fixing bugs when they are reported.

Best,

=2D-=20
Alexandre


From MAILER-DAEMON Tue Jan 04 14:29:27 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PaCZS-0005Sa-WE
	for mharc-libqtlua-list@gnu.org; Tue, 04 Jan 2011 14:29:27 -0500
Received: from [140.186.70.92] (port=37170 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PaCZR-0005Rk-4U
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 14:29:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PaCZP-00030X-RA
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 14:29:24 -0500
Received: from mail-yx0-f195.google.com ([209.85.213.195]:46112)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PaCZP-00030S-Ee
	for libqtlua-list@nongnu.org; Tue, 04 Jan 2011 14:29:23 -0500
Received: by yxk30 with SMTP id 30so2793537yxk.10
	for <libqtlua-list@nongnu.org>; Tue, 04 Jan 2011 11:29:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:in-reply-to
	:references:date:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=vHfI6qmPJ8cpX04s2DQze6Ysgt0Ii1BS1dOi7C1MptM=;
	b=ZX8OjiMljvyL+mUiS3ADlTMKfP+y2C8d99Vm6cCkiEjtneXXQ6BSLHHQvh6wp2IwvV
	Ag2dFqt/2tjw09vFxGQS/YWck4Qe8IWxBRrK1bbVhVm2nsren7V1Fn4supSf0ykzjxk2
	SxwG4vzevFzlVJjZdsmkvMI18oN2NaaRj+J0E=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=g7X/9kxJ1TopF/uu8qT+MgHsdtOe7+8iC1XJgf5sawz1ETlkIFjdgiM5b7421rpMwN
	KYJTj+KvTOakgtrsiD0ICZ8/9MLcqSXDLhxS4Fx9S1KBvQALVIhH9zZeTmFyr9SLD5Vx
	ooocK+vHyExlGbWX/5MIIPuBxQrZ1hvg9WKMk=
MIME-Version: 1.0
Received: by 10.150.191.14 with SMTP id o14mr20433141ybf.344.1294169362722;
	Tue, 04 Jan 2011 11:29:22 -0800 (PST)
Received: by 10.150.50.14 with HTTP; Tue, 4 Jan 2011 11:29:22 -0800 (PST)
In-Reply-To: <201101041951.58320.alexandre.becoulet@free.fr>
References: <AANLkTi=R8adf53Hu5yVD73YF3Ow7zrRStXLo+ehLyhGf@mail.gmail.com>
	<201101041951.58320.alexandre.becoulet@free.fr>
Date: Tue, 4 Jan 2011 17:29:22 -0200
Message-ID: <AANLkTi=Sg-v8SindL4FHTbiEDS67ob46SWbHmqhPWS1g@mail.gmail.com>
Subject: Re: [Libqtlua-list] Project maintenance
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Jan 2011 19:29:26 -0000

On Tue, Jan 4, 2011 at 4:51 PM, Alexandre Becoulet
<alexandre.becoulet@free.fr> wrote:
> On Tuesday, January 04, 2011 01:49:09 pm Gustavo de S=E1 Carvalho Honorat=
o wrote:
>
> Hi,
>
>> I saw in the project's site that QtLua is tested against Qt 4.5, which
>> is quite old. This project is currently active?
>
> I'am using this project and add new features as needed for my use.
> The library is in a stable state. I'am currently using QtLua 1.2.1 with
> Qt 4.7.1. You are right, I have to update the Qt version on the website.
>
> Note that QtLua code does not need update on new Qt4 release as it's
> not a binding. It relies on Qt meta-object system to list QObjects
> members at run-time and it doesn't aim at wrapping the whole Qt API.
>

Great! I'm writting an application using Qt and I would like to use
Lua instead of QtScript to provide scripting for my application. I
will make some conceptual tests with QtLua and if it's ok I'll use it
and will contribute. Do you encourage contributions?

On last thing: I saw a disclaimer in QtLua documentation but it isn't
clear for me which license (GPL or LGPL) is used by QtLua. It's
important because the application I'm developing will be commercial.

> I'am fixing bugs when they are reported.
>
> Best,
>
> --
> Alexandre
>
>


From MAILER-DAEMON Mon Jan 10 13:54:13 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PcMsf-0004mW-Ko
	for mharc-libqtlua-list@gnu.org; Mon, 10 Jan 2011 13:54:13 -0500
Received: from [140.186.70.92] (port=44390 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PcMsd-0004jf-8n
	for libqtlua-list@nongnu.org; Mon, 10 Jan 2011 13:54:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PcMsb-0002zJ-2A
	for libqtlua-list@nongnu.org; Mon, 10 Jan 2011 13:54:11 -0500
Received: from mail-gx0-f173.google.com ([209.85.161.173]:47106)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PcMsa-0002x2-Ul
	for libqtlua-list@nongnu.org; Mon, 10 Jan 2011 13:54:09 -0500
Received: by gxk24 with SMTP id 24so8909763gxk.4
	for <libqtlua-list@nongnu.org>; Mon, 10 Jan 2011 10:54:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:date:message-id
	:subject:from:to:content-type;
	bh=H5Qqok4XBp7MLD9hlCbBjSzuXcpZigmYupeUrMWNjLU=;
	b=EY0NvjCznTUcTrT1INz/b6/kcfwcqfZkbsZi96J+cV4m7MtQUl8jKYmtUuk4z3gAhY
	z6YFu4zXrcOdgw6zG5JrrY71d+pMDPGXq+D6KWGQeS6ajCaOIboLOtn7+WvoFaf6XjrL
	O4YkziL2ux3sYNvTbmLunCimjACIHSxzbvAYI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=Ro3qLtVxnic18VeLy3m+HDwo6Z/dUa2zEC+cvkCJM68m17Ge1I2fDrQrdT/tCWuJ0Y
	gFpUJABt+G1hM700QFaEB+t0iwlWlOr4n4ge1jzrr761cWmpWJZ75QOGBB4LLUnAGXEd
	KvNGhXhjPVAF2ciae3G44YrVpzQP2uCYnqPF4=
MIME-Version: 1.0
Received: by 10.151.98.15 with SMTP id a15mr29022126ybm.287.1294685647535;
	Mon, 10 Jan 2011 10:54:07 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Mon, 10 Jan 2011 10:54:07 -0800 (PST)
Date: Mon, 10 Jan 2011 16:54:07 -0200
Message-ID: <AANLkTikCZ6Px=D7vVRxVmHtz8XRcixb7fgAXWG9V08Z9@mail.gmail.com>
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: libqtlua-list@nongnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [Libqtlua-list] Qt API's available in QtLua
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 10 Jan 2011 18:54:12 -0000

Hi,

I would like to know if the following tasks can be done in using Lua code:

1) Implementing Custom Delegates
2) Drawing with QPainter API
3) Access QUndoFramework (implementing QUndoCommand and using
QUndoStack in Lua code)

Thanks,
Gustavo


From MAILER-DAEMON Tue Jan 11 09:28:00 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PcfCa-0007cf-8N
	for mharc-libqtlua-list@gnu.org; Tue, 11 Jan 2011 09:28:00 -0500
Received: from [140.186.70.92] (port=37313 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PcfCX-0007as-N8
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 09:27:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PcfCU-0006g1-R7
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 09:27:57 -0500
Received: from mail-gx0-f173.google.com ([209.85.161.173]:64660)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PcfCU-0006fn-OU
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 09:27:54 -0500
Received: by gxk24 with SMTP id 24so9289885gxk.4
	for <libqtlua-list@nongnu.org>; Tue, 11 Jan 2011 06:27:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:date:message-id
	:subject:from:to:content-type;
	bh=di3dnBTJ6uTmdbynkvkHIS3433TK9v1E/ahHcCCvhKQ=;
	b=jgLeBP/aCIIHGs8kmj7TtPwrbbdeyyBpeXUQ6fYgziASe0YItNfNfvlmyAQVvpkyD9
	pCrYgdcGuxwsNkESPu4KbvRqKlmAHLk5YlNl74MhW146ePh/pGKmIWj27Bd4/LXWu7ng
	h3gp9pbkKfugiMV+Fa9C1soJNs35o4FmD2f8k=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=tdxF6TbcLESFviQbu/Kf9brdJ3qcgzqAoWpXOcOq+ugf3vWeWBBsZzgNCSBD2EQHxA
	uJurItFKjq8CBQHx4U+iJ/I2hL9tgg3JjN134FdUNrPIci21qAji4iPP4890qro0kd3t
	j9w6eyNqrnfRru3pJxxYFBggkDF2pV/QXPDaY=
MIME-Version: 1.0
Received: by 10.150.53.14 with SMTP id b14mr221659yba.59.1294756073835; Tue,
	11 Jan 2011 06:27:53 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Tue, 11 Jan 2011 06:27:53 -0800 (PST)
Date: Tue, 11 Jan 2011 12:27:53 -0200
Message-ID: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: libqtlua-list@nongnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [Libqtlua-list] Accessing QObject inside a property in Lua
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Jan 2011 14:27:58 -0000

Hi,

I'm trying to access my MainWindow class throught a property which is
declared inside my Application class in Lua. I've declared the
MainWindow using Q_DECLARE_METATYPE(MainWindow*) and
qRegisterMetaType<MainWindow*>(). I've exposed my application class
using state["app"] = QtLua::Value(state, qApp, false).

The problem occurs when I try to access the MainWindow by typing
app.mainWindow:close() in Lua Console, and I got the error "error:
[string ""]:1: attempt to index field 'mainWindow' (a nil value)".

It's quite weird because when I type list(app) I can see that the
property mainWindow has a value QtLua::Property<MainWindow*>
mainWindow = Application::mainWindow.

Any help?

Thanks in advance,
Gustavo


From MAILER-DAEMON Tue Jan 11 18:04:47 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PcnGh-0004nR-J1
	for mharc-libqtlua-list@gnu.org; Tue, 11 Jan 2011 18:04:47 -0500
Received: from [140.186.70.92] (port=35269 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PcnGY-0004jq-BW
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 18:04:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PcnGS-0007UF-B4
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 18:04:37 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:47011)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PcnGR-0007SB-L5
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 18:04:32 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id 8CC5B4C80A7
	for <libqtlua-list@nongnu.org>; Wed, 12 Jan 2011 00:04:25 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: libqtlua-list@nongnu.org
Subject: Re: [Libqtlua-list] Qt API's available in QtLua
Date: Wed, 12 Jan 2011 00:08:28 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.4; x86_64; ; )
References: <AANLkTikCZ6Px=D7vVRxVmHtz8XRcixb7fgAXWG9V08Z9@mail.gmail.com>
In-Reply-To: <AANLkTikCZ6Px=D7vVRxVmHtz8XRcixb7fgAXWG9V08Z9@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201101120008.28639.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Jan 2011 23:04:46 -0000

On Monday, January 10, 2011 07:54:07 pm Gustavo de S=E1 Carvalho Honorato w=
rote:

Hi,

> I would like to know if the following tasks can be done in using Lua code:

> 1) Implementing Custom Delegates

This feature could be added, we just have to define a way to wrap the API i=
n=20
lua. The best way would probably be to have a ItemDelegate class which inhe=
rit=20
from UserData or UserObject to expose lua callback functions for the=20
createEditor, setEditorData, setModelData and updateEditorGeometry C++=20
functions. I never used custom delegates yet, let me know what you think.

> 2) Drawing with QPainter API
> 3) Access QUndoFramework (implementing QUndoCommand and using
> QUndoStack in Lua code)

QtLua was not designed to provide wrapping for the whole Qt API but rather =
to=20
let the Qt application developper choose, and provide features to easily wr=
ap=20
what is needed and keep other things away from script access.

Some important Qt UI features are wrapped in the "qt" lua table though.=20
QtLua::Function must be used to wrap more (Have a look to src/qtluaqtlib.cc=
).
A question remain about which Qt features are of general use and which are =
too=20
specific to be wrapped in the library. Parts of the Qt API which allow=20
extending application interface with the script language are of interest to=
=20
me.

=2D-=20
Alexandre



From MAILER-DAEMON Tue Jan 11 18:52:38 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Pco10-0002CF-H7
	for mharc-libqtlua-list@gnu.org; Tue, 11 Jan 2011 18:52:38 -0500
Received: from [140.186.70.92] (port=46002 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Pco0o-00025B-K1
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 18:52:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1Pco0i-0007Rh-Py
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 18:52:26 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:59564)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1Pco0i-0007RQ-7P
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 18:52:20 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id 930924C809B
	for <libqtlua-list@nongnu.org>; Wed, 12 Jan 2011 00:52:14 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: libqtlua-list@nongnu.org
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
Date: Wed, 12 Jan 2011 00:56:17 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.4; x86_64; ; )
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
In-Reply-To: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201101120056.17934.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Jan 2011 23:52:35 -0000

On Tuesday, January 11, 2011 03:27:53 pm Gustavo de S=E1 Carvalho Honorato=
=20
wrote:

Hi,

> I'm trying to access my MainWindow class throught a property which is
> declared inside my Application class in Lua. I've declared the
> MainWindow using Q_DECLARE_METATYPE(MainWindow*) and
> qRegisterMetaType<MainWindow*>(). I've exposed my application class
> using state["app"] =3D QtLua::Value(state, qApp, false).
>=20
> The problem occurs when I try to access the MainWindow by typing
> app.mainWindow:close() in Lua Console, and I got the error "error:
> [string ""]:1: attempt to index field 'mainWindow' (a nil value)".
>=20
> It's quite weird because when I type list(app) I can see that the
> property mainWindow has a value QtLua::Property<MainWindow*>
> mainWindow =3D Application::mainWindow.

QtLua has no way to guess how to convert your declared meta type to a=20
QtLua::Value. Try using a QObject* or QWidget* instead of a MainWindow*=20
pointer type.

Lua/Qt values convertion on property access and method call is performed by=
=20
raw_get_object and raw_set_object in src/qtluamember.cc. Supporting dynamic=
=20
declaration of new types would require registering two callbacks to impleme=
nt=20
value convertion, I can implement this if there is a real need.

=2D-=20
Alexandre



From MAILER-DAEMON Tue Jan 11 20:03:15 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Pcp7K-0004CO-TX
	for mharc-libqtlua-list@gnu.org; Tue, 11 Jan 2011 20:03:14 -0500
Received: from [140.186.70.92] (port=38114 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Pcp7J-0004Bg-6J
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 20:03:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pcp7H-0002aL-TE
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 20:03:12 -0500
Received: from mail-gy0-f173.google.com ([209.85.160.173]:57809)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pcp7H-0002a7-QV
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 20:03:11 -0500
Received: by gye5 with SMTP id 5so24464gye.4
	for <libqtlua-list@nongnu.org>; Tue, 11 Jan 2011 17:03:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=8EKler/+Lcy2GNNBOaAdNUDWSjfOaFg4utABJHe0ML4=;
	b=fzE8WO+pgUdgeM4QissJticejICxuRufbMeSiaNEoqkrfilaFwb9NfNOkGPmCQM1j0
	Hu2RruktDTaiXkCMTASUEjcYSJq2ywZ7aAPoVMsfFRBPhd5u795IA2k9lSu/W3UBCrR3
	VudyQZSo6nuiLlRG7j9BMRarUWsonzRP1IPZQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=NGCm1OLQrF6uuk/RTkDNa7IGtV0xBNvV2f8IS0QevQivJ1pDZlmAaOBFxaSmTiJYuR
	jW/+H033+MP57zPdmTDy/fyAhou6z+EPCckYRsSBb0R4XRkSOUOzfX0ES3GcAJZSn5on
	YLwosRVIxZ2QHvau8fZc08nR027zUQfDr7TQc=
MIME-Version: 1.0
Received: by 10.150.177.17 with SMTP id z17mr970806ybe.173.1294794189183; Tue,
	11 Jan 2011 17:03:09 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Tue, 11 Jan 2011 17:03:08 -0800 (PST)
In-Reply-To: <201101120056.17934.alexandre.becoulet@free.fr>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101120056.17934.alexandre.becoulet@free.fr>
Date: Tue, 11 Jan 2011 23:03:08 -0200
Message-ID: <AANLkTi=u=dP4E0a5F7ddy-z+chTOgBVTjW88uGEAnUcU@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Jan 2011 01:03:14 -0000

On Tue, Jan 11, 2011 at 9:56 PM, Alexandre Becoulet
<alexandre.becoulet@free.fr> wrote:
> On Tuesday, January 11, 2011 03:27:53 pm Gustavo de S=E1 Carvalho Honorat=
o
> wrote:
>
> Hi,
>
>> I'm trying to access my MainWindow class throught a property which is
>> declared inside my Application class in Lua. I've declared the
>> MainWindow using Q_DECLARE_METATYPE(MainWindow*) and
>> qRegisterMetaType<MainWindow*>(). I've exposed my application class
>> using state["app"] =3D QtLua::Value(state, qApp, false).
>>
>> The problem occurs when I try to access the MainWindow by typing
>> app.mainWindow:close() in Lua Console, and I got the error "error:
>> [string ""]:1: attempt to index field 'mainWindow' (a nil value)".
>>
>> It's quite weird because when I type list(app) I can see that the
>> property mainWindow has a value QtLua::Property<MainWindow*>
>> mainWindow =3D Application::mainWindow.
>
> QtLua has no way to guess how to convert your declared meta type to a
> QtLua::Value. Try using a QObject* or QWidget* instead of a MainWindow*
> pointer type.

Sorry, I gave you an incomplete information. MainWindow inherits from
QMainWindow which inherits from QWidget. I've registered MainWindow*
type because when I tried to access mainWindow property, I was getting
"QMetaProperty::read: Unable to handle unregistered datatype" error.

>
> Lua/Qt values convertion on property access and method call is performed =
by
> raw_get_object and raw_set_object in src/qtluamember.cc. Supporting dynam=
ic
> declaration of new types would require registering two callbacks to imple=
ment
> value convertion, I can implement this if there is a real need.

It is necessary only for types which not inherits from QObject, am I
right? Implementing this will enable custom defined types with
QT_DECLARE_METATYPE to be handled in Lua code, is it?

>
> --
> Alexandre
>
>
>


From MAILER-DAEMON Tue Jan 11 20:39:56 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Pcpgq-0002eV-8M
	for mharc-libqtlua-list@gnu.org; Tue, 11 Jan 2011 20:39:56 -0500
Received: from [140.186.70.92] (port=59967 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Pcpgn-0002eQ-BC
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 20:39:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pcpgl-00014g-Rw
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 20:39:53 -0500
Received: from mail-gx0-f173.google.com ([209.85.161.173]:51159)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pcpgl-00014S-Le
	for libqtlua-list@nongnu.org; Tue, 11 Jan 2011 20:39:51 -0500
Received: by gxk24 with SMTP id 24so41552gxk.4
	for <libqtlua-list@nongnu.org>; Tue, 11 Jan 2011 17:39:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=Y3pnWsyMIGXqDdaKeCJMNUYAgp4wbQease6DcSP3tIg=;
	b=JXjYkdFzc3QRfK7XUCfhUMEWdTADaz4e0o0Q5Gbrf6fOFZLb/eX6gHZlhlWwH3ZpZr
	ChHOI8P45jeD9+XjaVW6yWih58cOd/gqOEbK1//dwjPQRW+RdmBAV+M0RYkZTTaOQyFk
	rxw7vR6DftEof89BbFPBIkES8nJ2G6IMy25Ww=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=Ogm/d1khL4RejLUc1V7Ts2lm/n3A2av6LA4DnJ4HvVhSAMm0QxTsmT6LlCeOX2CMHu
	WJDYV01bDBUqBgiEWxYqv5FBLFeHZO7iVaqk9HOFx1huOMxEfYiIOJkIndXZdkITVdAU
	Bm35nfcGnYy4RHs4g0OV3VjDGZE1jna2FwD2A=
MIME-Version: 1.0
Received: by 10.150.53.14 with SMTP id b14mr1176110yba.59.1294796387535; Tue,
	11 Jan 2011 17:39:47 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Tue, 11 Jan 2011 17:39:47 -0800 (PST)
In-Reply-To: <201101120008.28639.alexandre.becoulet@free.fr>
References: <AANLkTikCZ6Px=D7vVRxVmHtz8XRcixb7fgAXWG9V08Z9@mail.gmail.com>
	<201101120008.28639.alexandre.becoulet@free.fr>
Date: Tue, 11 Jan 2011 23:39:47 -0200
Message-ID: <AANLkTimGi7zemHQaAbQbMAaS9H1epH3c+A3DHOP_Z1Pa@mail.gmail.com>
Subject: Re: [Libqtlua-list] Qt API's available in QtLua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Jan 2011 01:39:54 -0000

On Tue, Jan 11, 2011 at 9:08 PM, Alexandre Becoulet
<alexandre.becoulet@free.fr> wrote:
> On Monday, January 10, 2011 07:54:07 pm Gustavo de S=E1 Carvalho Honorato=
 wrote:
>
> Hi,
>
>> I would like to know if the following tasks can be done in using Lua cod=
e:
>
>> 1) Implementing Custom Delegates
>
> This feature could be added, we just have to define a way to wrap the API=
 in
> lua. The best way would probably be to have a ItemDelegate class which in=
herit
> from UserData or UserObject to expose lua callback functions for the
> createEditor, setEditorData, setModelData and updateEditorGeometry C++
> functions. I never used custom delegates yet, let me know what you think.
>

I'm thinking to implement my core application model and the
Supervising Controller Pattern
(http://martinfowler.com/eaaDev/SupervisingPresenter.html) using Lua.
I've made this decision because Lua has a lot of dynamic features such
easiness of implement aspect oriented programming through functional
programming which facilitates to implement the business logic. Also,
it's easier to mock and test the Supervising Controllers in Lua than
in C++. Finally, we are planning to make possible to extend the
application using plugins written in Lua.


>> 2) Drawing with QPainter API

I asked about the Qt Drawing API because the application which I'm
writting makes a heavy use QGraphicsView API. To create custom items
in QGraphicsView and Custom Delegates is often necessary to use
QPainter and other things related to drawing. To leverage the
extensibility of my application, it would be good to support extension
of QGraphicsView using Lua code.

>> 3) Access QUndoFramework (implementing QUndoCommand and using
>> QUndoStack in Lua code)
>
> QtLua was not designed to provide wrapping for the whole Qt API but rathe=
r to
> let the Qt application developper choose, and provide features to easily =
wrap
> what is needed and keep other things away from script access.
>
> Some important Qt UI features are wrapped in the "qt" lua table though.
> QtLua::Function must be used to wrap more (Have a look to src/qtluaqtlib.=
cc).
> A question remain about which Qt features are of general use and which ar=
e too
> specific to be wrapped in the library. Parts of the Qt API which allow
> extending application interface with the script language are of interest =
to
> me.

I thought and decided that the best place to put commands is in
Supervising Controllers. Because we plan to write Supervising
Controllers in Lua, it will be necessary to have access Qt Undo
Framework in Lua. Also, plugins written in Lua might need to declare
new commands to permit the user undo and redo specific tasks available
by the plugin.

>
> --
> Alexandre
>
>
>


From MAILER-DAEMON Wed Jan 12 19:03:06 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PdAeg-0003uL-HC
	for mharc-libqtlua-list@gnu.org; Wed, 12 Jan 2011 19:03:06 -0500
Received: from [140.186.70.92] (port=49705 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PdAee-0003tZ-2c
	for libqtlua-list@nongnu.org; Wed, 12 Jan 2011 19:03:05 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PdAec-0000Eo-3o
	for libqtlua-list@nongnu.org; Wed, 12 Jan 2011 19:03:03 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:45781)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PdAeb-0000E0-FF
	for libqtlua-list@nongnu.org; Wed, 12 Jan 2011 19:03:02 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id C28B84C80AD;
	Thu, 13 Jan 2011 01:02:54 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: Gustavo de =?iso-8859-1?q?S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
Date: Thu, 13 Jan 2011 01:07:08 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.4; x86_64; ; )
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101120056.17934.alexandre.becoulet@free.fr>
	<AANLkTi=u=dP4E0a5F7ddy-z+chTOgBVTjW88uGEAnUcU@mail.gmail.com>
In-Reply-To: <AANLkTi=u=dP4E0a5F7ddy-z+chTOgBVTjW88uGEAnUcU@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201101130107.08673.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Jan 2011 00:03:05 -0000

On Wednesday, January 12, 2011 02:03:08 am you wrote:

Hi,

> >> The problem occurs when I try to access the MainWindow by typing
> >> app.mainWindow:close() in Lua Console, and I got the error "error:
> >> [string ""]:1: attempt to index field 'mainWindow' (a nil value)".
> >> 
> >> It's quite weird because when I type list(app) I can see that the
> >> property mainWindow has a value QtLua::Property<MainWindow*>
> >> mainWindow = Application::mainWindow.
> > 
> > QtLua has no way to guess how to convert your declared meta type to a
> > QtLua::Value. Try using a QObject* or QWidget* instead of a MainWindow*
> > pointer type.
> 
> Sorry, I gave you an incomplete information. MainWindow inherits from
> QMainWindow which inherits from QWidget. I've registered MainWindow*
> type because when I tried to access mainWindow property, I was getting
> "QMetaProperty::read: Unable to handle unregistered datatype" error.

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.

Qt meta types unknown to QtLua are converted to nil values. 

So you have to use QObject* or QWidget* type with Q_PROPERTY() property 
declaration instead of MainWindow* because these types are already known to Qt 
and have convertion code in QtLua. Value convertion will work and QtLua should 
still dynamically expose the object as a MainWindow with its specific members.

> > Lua/Qt values convertion on property access and method call is performed
> > by raw_get_object and raw_set_object in src/qtluamember.cc. Supporting
> > dynamic declaration of new types would require registering two callbacks
> > to implement value convertion, I can implement this if there is a real
> > need.
> 
> It is necessary only for types which not inherits from QObject, am I
> right?

It would be necessary for all types which are not handled,
even for pointer types which inherit from QObject.

See
http://www.nongnu.org/libqtlua/manual/node5.html
http://doc.qt.nokia.com/4.6/qmetatype.html#Type-enum

> Implementing this will enable custom defined types with
> QT_DECLARE_METATYPE to be handled in Lua code, is it?

Yes. It would allow to provide callback to convert any Qt/C++ type to a lua 
value in both directions. For classes inheriting from QObject, QtLua could 
even provide template callback functions which just need to be registered with 
the class as template parameter. It would take place just after 
qRegisterMetaType invocation.

-- 
Alexandre



From MAILER-DAEMON Fri Jan 14 11:39:16 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PdmgG-0005zA-NB
	for mharc-libqtlua-list@gnu.org; Fri, 14 Jan 2011 11:39:16 -0500
Received: from [140.186.70.92] (port=42555 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PdmgE-0005wH-BF
	for libqtlua-list@nongnu.org; Fri, 14 Jan 2011 11:39:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PdmgD-0007Ud-3N
	for libqtlua-list@nongnu.org; Fri, 14 Jan 2011 11:39:14 -0500
Received: from mail-gy0-f173.google.com ([209.85.160.173]:40596)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PdmgD-0007UP-11
	for libqtlua-list@nongnu.org; Fri, 14 Jan 2011 11:39:13 -0500
Received: by gye5 with SMTP id 5so1484142gye.4
	for <libqtlua-list@nongnu.org>; Fri, 14 Jan 2011 08:39:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type;
	bh=TOCvTyDgMCE2JI92uPSUNMBhTTa3rfYGkkVokGFFKjY=;
	b=pekoObO7/qSW3t9Rq6MT2o8EwNerJuDAS9VV3ZJ15VEvbaFDl1RAX11W422AOJYDoA
	pwRfPXfRJMkDYpsIVmKcIOOv+LT8CU2+0Z32Rfq/Yv+X+J3Yj1FZqTjnAA0TDD4M9nlg
	A7LvBPoim5iMHPPFhLPKTgAk++bUWQVIjJNGQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	b=q0n3NaTkWz7fZ4bbeRsLh+3BBnd5Ns1cCf+mxKmVo29dJKxbd9Nzg1OuW23UDYkYQ6
	fSGWD9cl8C6FhQKVTpbpVQktE5XEqaYurH0KtaITAGSLFRrV9QzPfX4Rkun8iMGhgaAm
	sOL8LpkFhMzZNTY4LNhIylWDicQj6pVlQ7nAg=
MIME-Version: 1.0
Received: by 10.151.98.15 with SMTP id a15mr1396138ybm.287.1295023151267; Fri,
	14 Jan 2011 08:39:11 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Fri, 14 Jan 2011 08:39:11 -0800 (PST)
In-Reply-To: <201101130107.08673.alexandre.becoulet@free.fr>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101120056.17934.alexandre.becoulet@free.fr>
	<AANLkTi=u=dP4E0a5F7ddy-z+chTOgBVTjW88uGEAnUcU@mail.gmail.com>
	<201101130107.08673.alexandre.becoulet@free.fr>
Date: Fri, 14 Jan 2011 14:39:11 -0200
Message-ID: <AANLkTimC2Uo=2wSO3M+VoKJMYQHaYb4FKc=sJpf0582B@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Fri, 14 Jan 2011 16:39:15 -0000

2011/1/12 Alexandre Becoulet <alexandre.becoulet@free.fr>
>
> On Wednesday, January 12, 2011 02:03:08 am you wrote:
>
> Hi,
>
> > >> The problem occurs when I try to access the MainWindow by typing
> > >> app.mainWindow:close() in Lua Console, and I got the error "error:
> > >> [string ""]:1: attempt to index field 'mainWindow' (a nil value)".
> > >>
> > >> It's quite weird because when I type list(app) I can see that the
> > >> property mainWindow has a value QtLua::Property<MainWindow*>
> > >> mainWindow = Application::mainWindow.
> > >
> > > QtLua has no way to guess how to convert your declared meta type to a
> > > QtLua::Value. Try using a QObject* or QWidget* instead of a MainWindow*
> > > pointer type.
> >
> > Sorry, I gave you an incomplete information. MainWindow inherits from
> > QMainWindow which inherits from QWidget. I've registered MainWindow*
> > type because when I tried to access mainWindow property, I was getting
> > "QMetaProperty::read: Unable to handle unregistered datatype" error.
>
> 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.

It's not possible to discover that MainWindow inherits from QObject by
searching its superclasses using the method
mainWindow->metaObject()->superClass() ?

>
> Qt meta types unknown to QtLua are converted to nil values.
>
> So you have to use QObject* or QWidget* type with Q_PROPERTY() property
> declaration instead of MainWindow* because these types are already known to Qt
> and have convertion code in QtLua. Value convertion will work and QtLua should
> still dynamically expose the object as a MainWindow with its specific members.

The problem with this approach is that in C++ side I'll have more
generic properties and if I need to access those properties in C++
code I'll need to use typecasting in every access to those properties.
I think a better approach is to add support to QtLua to handle custom
types. I can implement this feature if you are too busy, it should be
good for me to improve my knowledge of QtLua. If you agree, I'll just
need some directions because I don't know where to start.

>
> > > Lua/Qt values convertion on property access and method call is performed
> > > by raw_get_object and raw_set_object in src/qtluamember.cc. Supporting
> > > dynamic declaration of new types would require registering two callbacks
> > > to implement value convertion, I can implement this if there is a real
> > > need.
> >
> > It is necessary only for types which not inherits from QObject, am I
> > right?
>
> It would be necessary for all types which are not handled,
> even for pointer types which inherit from QObject.
>
> See
> http://www.nongnu.org/libqtlua/manual/node5.html
> http://doc.qt.nokia.com/4.6/qmetatype.html#Type-enum
>
> > Implementing this will enable custom defined types with
> > QT_DECLARE_METATYPE to be handled in Lua code, is it?
>
> Yes. It would allow to provide callback to convert any Qt/C++ type to a lua
> value in both directions. For classes inheriting from QObject, QtLua could
> even provide template callback functions which just need to be registered with
> the class as template parameter. It would take place just after
> qRegisterMetaType invocation.
>
> --
> Alexandre
>


From MAILER-DAEMON Sun Jan 16 19:17:12 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PecmW-0002Bf-16
	for mharc-libqtlua-list@gnu.org; Sun, 16 Jan 2011 19:17:12 -0500
Received: from [140.186.70.92] (port=41210 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PecmT-0002BK-35
	for libqtlua-list@nongnu.org; Sun, 16 Jan 2011 19:17:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PecmQ-0005Hy-L3
	for libqtlua-list@nongnu.org; Sun, 16 Jan 2011 19:17:08 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:49404)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PecmP-0005Hj-VO
	for libqtlua-list@nongnu.org; Sun, 16 Jan 2011 19:17:06 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id 6C3F84C802F;
	Mon, 17 Jan 2011 01:16:59 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: Gustavo de =?iso-8859-1?q?S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
Date: Mon, 17 Jan 2011 01:21:28 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; x86_64; ; )
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101130107.08673.alexandre.becoulet@free.fr>
	<AANLkTimC2Uo=2wSO3M+VoKJMYQHaYb4FKc=sJpf0582B@mail.gmail.com>
In-Reply-To: <AANLkTimC2Uo=2wSO3M+VoKJMYQHaYb4FKc=sJpf0582B@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201101170121.28512.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jan 2011 00:17:10 -0000

On Friday, January 14, 2011 05:39:11 pm you wrote:

Hi

> > > >> The problem occurs when I try to access the MainWindow by typing
> > > >> app.mainWindow:close() in Lua Console, and I got the error "error:
> > > >> [string ""]:1: attempt to index field 'mainWindow' (a nil value)".
> > > >> 
> > > >> It's quite weird because when I type list(app) I can see that the
> > > >> property mainWindow has a value QtLua::Property<MainWindow*>
> > > >> mainWindow = Application::mainWindow.
> > > > 
> > > > QtLua has no way to guess how to convert your declared meta type to a
> > > > QtLua::Value. Try using a QObject* or QWidget* instead of a
> > > > MainWindow* pointer type.
> > > 
> > > Sorry, I gave you an incomplete information. MainWindow inherits from
> > > QMainWindow which inherits from QWidget. I've registered MainWindow*
> > > type because when I tried to access mainWindow property, I was getting
> > > "QMetaProperty::read: Unable to handle unregistered datatype" error.
> > 
> > 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.
> 
> It's not possible to discover that MainWindow inherits from QObject by
> searching its superclasses using the method
> mainWindow->metaObject()->superClass() ?

You are right it is, but we still have to find a way to cast MainWindow 
pointer to QObject pointer dynamically. I'll try to figure it out.

> > Qt meta types unknown to QtLua are converted to nil values.
> > 
> > So you have to use QObject* or QWidget* type with Q_PROPERTY() property
> > declaration instead of MainWindow* because these types are already known
> > to Qt and have convertion code in QtLua. Value convertion will work and
> > QtLua should still dynamically expose the object as a MainWindow with
> > its specific members.
> 
> The problem with this approach is that in C++ side I'll have more
> generic properties and if I need to access those properties in C++
> code I'll need to use typecasting in every access to those properties.

Right, C++ access will be tricky.

> I think a better approach is to add support to QtLua to handle custom
> types. I can implement this feature if you are too busy, it should be
> good for me to improve my knowledge of QtLua. If you agree, I'll just
> need some directions because I don't know where to start.

It should not take too long for me to implement, it's just a matter of 
accessing a QMap in the 'default:' section of a switch statement to handle 
dynamically registered types cases. I have precise idea of how user callbacks 
should be implemented and will update the manual with examples.

You may want to spend time on features you need for your applications, like 
custom delegates and other things we discussed instead of studying all behind 
the scene hacks of the Qt meta object system to implement a simple feature:).

-- 
Alexandre


From MAILER-DAEMON Mon Jan 17 13:39:43 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PetzT-0006pD-3I
	for mharc-libqtlua-list@gnu.org; Mon, 17 Jan 2011 13:39:43 -0500
Received: from [140.186.70.92] (port=42464 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PetzQ-0006nc-4u
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 13:39:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PetzO-0003bB-N4
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 13:39:39 -0500
Received: from mail-gx0-f173.google.com ([209.85.161.173]:53420)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PetzO-0003av-I4
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 13:39:38 -0500
Received: by gxk24 with SMTP id 24so2651393gxk.4
	for <libqtlua-list@nongnu.org>; Mon, 17 Jan 2011 10:39:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type;
	bh=0ljiNcvOtegvr77PeBYNTln2A5aYp2G/RuqMQLZdzVg=;
	b=gWEBMHvBS0gXkPLj4PWCBF4IO1aBY17/lq7dyFArcNFXivRYDFDhpvXAqdAD1PYdfA
	eewjhf1mAyMpxDNz8mWBoU071w88QM3YtynzB3GUTh+6bReS4D5D08odYlUck5Ch3RDF
	chL34oV8bn7Qkmxn+aGcNPWYqkFQwSZkKEKTo=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	b=d0W7THABwn433hmM9CxFbmCSaXrHVl0Z2vYdDJwFhafu2ETTtGYP1noqKo5mXNCG9u
	X2pxW+bJ9/3KP6TmSM5dH3TlVDTU5n869olmtPusgwAU1rpdbguBM5lNLuqWEpVBbrzv
	v6kxJybWf0wYQ9woQoPmHHrI+VNx0zpQG1RvY=
MIME-Version: 1.0
Received: by 10.150.139.19 with SMTP id m19mr212108ybd.116.1295289577363; Mon,
	17 Jan 2011 10:39:37 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Mon, 17 Jan 2011 10:39:37 -0800 (PST)
In-Reply-To: <201101170121.28512.alexandre.becoulet@free.fr>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101130107.08673.alexandre.becoulet@free.fr>
	<AANLkTimC2Uo=2wSO3M+VoKJMYQHaYb4FKc=sJpf0582B@mail.gmail.com>
	<201101170121.28512.alexandre.becoulet@free.fr>
Date: Mon, 17 Jan 2011 16:39:37 -0200
Message-ID: <AANLkTinmxb2LOW84BX4ZQG4+4UA_tTpCf9_9R5gULb=-@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jan 2011 18:39:41 -0000

2011/1/16 Alexandre Becoulet <alexandre.becoulet@free.fr>:
> On Friday, January 14, 2011 05:39:11 pm you wrote:
>
> Hi
>
>> > > >> The problem occurs when I try to access the MainWindow by typing
>> > > >> app.mainWindow:close() in Lua Console, and I got the error "error:
>> > > >> [string ""]:1: attempt to index field 'mainWindow' (a nil value)".
>> > > >>
>> > > >> It's quite weird because when I type list(app) I can see that the
>> > > >> property mainWindow has a value QtLua::Property<MainWindow*>
>> > > >> mainWindow = Application::mainWindow.
>> > > >
>> > > > QtLua has no way to guess how to convert your declared meta type to a
>> > > > QtLua::Value. Try using a QObject* or QWidget* instead of a
>> > > > MainWindow* pointer type.
>> > >
>> > > Sorry, I gave you an incomplete information. MainWindow inherits from
>> > > QMainWindow which inherits from QWidget. I've registered MainWindow*
>> > > type because when I tried to access mainWindow property, I was getting
>> > > "QMetaProperty::read: Unable to handle unregistered datatype" error.
>> >
>> > 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.
>>
>> It's not possible to discover that MainWindow inherits from QObject by
>> searching its superclasses using the method
>> mainWindow->metaObject()->superClass() ?
>
> You are right it is, but we still have to find a way to cast MainWindow
> pointer to QObject pointer dynamically. I'll try to figure it out.

Have you tried qobject_cast ?

>
>> > Qt meta types unknown to QtLua are converted to nil values.
>> >
>> > So you have to use QObject* or QWidget* type with Q_PROPERTY() property
>> > declaration instead of MainWindow* because these types are already known
>> > to Qt and have convertion code in QtLua. Value convertion will work and
>> > QtLua should still dynamically expose the object as a MainWindow with
>> > its specific members.
>>
>> The problem with this approach is that in C++ side I'll have more
>> generic properties and if I need to access those properties in C++
>> code I'll need to use typecasting in every access to those properties.
>
> Right, C++ access will be tricky.
>
>> I think a better approach is to add support to QtLua to handle custom
>> types. I can implement this feature if you are too busy, it should be
>> good for me to improve my knowledge of QtLua. If you agree, I'll just
>> need some directions because I don't know where to start.
>
> It should not take too long for me to implement, it's just a matter of
> accessing a QMap in the 'default:' section of a switch statement to handle
> dynamically registered types cases. I have precise idea of how user callbacks
> should be implemented and will update the manual with examples.
>
> You may want to spend time on features you need for your applications, like
> custom delegates and other things we discussed instead of studying all behind
> the scene hacks of the Qt meta object system to implement a simple feature:).

Very good! Thanks! I'm looking forward to this feature. You can count
on me if you need any help.

>
> --
> Alexandre
>


From MAILER-DAEMON Mon Jan 17 17:20:59 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PexRb-0000HH-BB
	for mharc-libqtlua-list@gnu.org; Mon, 17 Jan 2011 17:20:59 -0500
Received: from [140.186.70.92] (port=47325 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PexRZ-0000H9-Jh
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:20:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PexRY-0001Mu-Ed
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:20:57 -0500
Received: from mail-yw0-f45.google.com ([209.85.213.45]:43828)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PexRY-0001Ml-9L
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:20:56 -0500
Received: by ywl5 with SMTP id 5so2411967ywl.4
	for <libqtlua-list@nongnu.org>; Mon, 17 Jan 2011 14:20:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=fmBLuEonHwXyWeOz5UtSkznTge9/vTGdI1mGv1RUU7s=;
	b=OjuxPmms+WCQ8Khab0W71RIx9QwpZs0dthLBgeCRL8ttHKS57LQeV2och7eyAhMb+2
	Fq/gHre/6CDpCaqt1avHWXuqia/TP8nF7HeHmHLRqKk/TdC8noy6ri6Tqz86crfEoxRq
	hk3FPeyYSbTfwKEyf8/LmQEtRSVsCRM+/RvvE=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=UkmGTyHntalBqhts3OAxxpT4eRAvomtDhzrBzElB5uoahsDkyR6PceAjQYIAwl1DXC
	TkKRaC50A5NUT6AeId+t2cOmXsnx6cUwFeiI/nnlLi665xCUIvl6jFDPIJoaiB203c+6
	wnquC6mwUSqVPMSKATRlUg5dk8ysQIF9mkWJE=
MIME-Version: 1.0
Received: by 10.150.139.19 with SMTP id m19mr346918ybd.116.1295302855497; Mon,
	17 Jan 2011 14:20:55 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Mon, 17 Jan 2011 14:20:55 -0800 (PST)
Date: Mon, 17 Jan 2011 20:20:55 -0200
Message-ID: <AANLkTimZZn48atYrONSNEeZozgQAoL1HCPUkpVewfM4Y@mail.gmail.com>
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: libqtlua-list@nongnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [Libqtlua-list] Implementing domain model classes/tables in Lua
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jan 2011 22:20:58 -0000

Hi,

I've mentioned in previous e-mails that I would like to implement the
bussiness logic of my application using Lua language because of its
facilities. However, I would like to access my model classes in Lua
and C++ in an easy way for both sides. One idea I have for doing this
is to create wrappers in C++ which delegates all getters/setters and
methods to the Lua table stored in a Value object inside my wrapper
class, but I'm having some doubts:

1) Do you think that creating this wrappers/delegators is a good
approach? Any suggestions?
2) What is the difference between Value and ValueRef? I suspect that
Value is a copy of a Lua data, so, if I change something in a Value
object using C++ code it won't reflect in Lua VM. Using ValueRef it
will reflect. In this manner, the correct way to implement my wrappers
is using ValueRef, right?
3) I've started to implement this approach (source in
http://pastebin.com/UtSepwTT), but I'm stuck with an error. In line
62, when I try to read the table size property with  return
value["size"]; I'm getting the following error: "Can not make value
reference with lua::nil type as table.". Could you help me?

Thanks again,
Gustavo


From MAILER-DAEMON Mon Jan 17 17:23:26 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PexTy-0000lb-P0
	for mharc-libqtlua-list@gnu.org; Mon, 17 Jan 2011 17:23:26 -0500
Received: from [140.186.70.92] (port=48874 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PexTw-0000lS-OB
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:23:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PexTv-00022V-I1
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:23:24 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:58961)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PexTu-00021y-Vc
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:23:23 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id DC6084C80AD;
	Mon, 17 Jan 2011 23:23:16 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: Gustavo de =?iso-8859-1?q?S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
Date: Mon, 17 Jan 2011 23:27:38 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; x86_64; ; )
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101170121.28512.alexandre.becoulet@free.fr>
	<AANLkTinmxb2LOW84BX4ZQG4+4UA_tTpCf9_9R5gULb=-@mail.gmail.com>
In-Reply-To: <AANLkTinmxb2LOW84BX4ZQG4+4UA_tTpCf9_9R5gULb=-@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201101172327.38987.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jan 2011 22:23:25 -0000

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?

> > It should not take too long for me to implement, it's just a matter of
> > accessing a QMap in the 'default:' section of a switch statement to
> > handle dynamically registered types cases. I have precise idea of how
> > user callbacks should be implemented and will update the manual with
> > examples.

> Very good! Thanks! I'm looking forward to this feature. You can count
> on me if you need any help.

Commited in subversion. Have a look to:
http://www.nongnu.org/libqtlua/manual/MetaType_class_reference.html

-- 
Alexandre



From MAILER-DAEMON Mon Jan 17 17:41:47 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Pexli-0007Kr-Tb
	for mharc-libqtlua-list@gnu.org; Mon, 17 Jan 2011 17:41:47 -0500
Received: from [140.186.70.92] (port=54325 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Pexlg-0007Ie-I9
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:41:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pexle-0006Rq-MC
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:41:44 -0500
Received: from mail-yw0-f45.google.com ([209.85.213.45]:42470)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pexle-0006Re-H8
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 17:41:42 -0500
Received: by ywl5 with SMTP id 5so2417539ywl.4
	for <libqtlua-list@nongnu.org>; Mon, 17 Jan 2011 14:41:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type;
	bh=bftuBNwxZkerCbTLeJnXA2QifN9S71egfnIbRc172Ek=;
	b=jQYlegmd50JZHcoRfTmTBxcQ4TOBC5MMbL4CfLptIiviFbCW2WqSTD2zgfaQepST5g
	iRHa16hSvXE6utV3Hhc/IaSxlAR1S07MlSPixj/ipZs8gCNbmXr151S7sPumoHcNudTl
	q8yr7naiWR6Fr1d8oRiCy7pR4XEmd7rF9uPOU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	b=Y3rvVMECq9zv+RU/k4arAcIFuR4uqbmZ8HcdqogLx7NMzlLpycX7zQcd46ZZrupa6O
	IN+R0Z95UCGvT/7TB4CUfompcjK0YIetlwANkO8WM257/idiLS1E3q2D/iGbP2Q2tnjT
	W5pH2W8G6RA+u82HUSSrrXRtC1rS9Rpq2WJnc=
MIME-Version: 1.0
Received: by 10.151.106.6 with SMTP id i6mr359917ybm.2.1295304099999; Mon, 17
	Jan 2011 14:41:39 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Mon, 17 Jan 2011 14:41:39 -0800 (PST)
In-Reply-To: <201101172327.38987.alexandre.becoulet@free.fr>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101170121.28512.alexandre.becoulet@free.fr>
	<AANLkTinmxb2LOW84BX4ZQG4+4UA_tTpCf9_9R5gULb=-@mail.gmail.com>
	<201101172327.38987.alexandre.becoulet@free.fr>
Date: Mon, 17 Jan 2011 20:41:39 -0200
Message-ID: <AANLkTik5r_nBuTnn_ut8dnLH9w-geX2MXoRVO595c8xH@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jan 2011 22:41:45 -0000

2011/1/17 Alexandre Becoulet <alexandre.becoulet@free.fr>:
> 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.

>
>> > It should not take too long for me to implement, it's just a matter of
>> > accessing a QMap in the 'default:' section of a switch statement to
>> > handle dynamically registered types cases. I have precise idea of how
>> > user callbacks should be implemented and will update the manual with
>> > examples.
>
>> Very good! Thanks! I'm looking forward to this feature. You can count
>> on me if you need any help.
>
> Commited in subversion. Have a look to:
> http://www.nongnu.org/libqtlua/manual/MetaType_class_reference.html

Great! You are very efficient. One suggestion: the page
http://www.nongnu.org/libqtlua/manual/node5.html could have a
reference to this new way of type conversion. What you think?

>
> --
> Alexandre
>
>


From MAILER-DAEMON Mon Jan 17 18:52:47 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PeysQ-00054k-TW
	for mharc-libqtlua-list@gnu.org; Mon, 17 Jan 2011 18:52:47 -0500
Received: from [140.186.70.92] (port=51405 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PeysO-00054a-L2
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 18:52:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PeysN-00025x-6m
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 18:52:44 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:59256)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PeysM-000259-K2
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 18:52:43 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id 8878F4C8066
	for <libqtlua-list@nongnu.org>; Tue, 18 Jan 2011 00:52:36 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: libqtlua-list@nongnu.org
Subject: Re: [Libqtlua-list] Implementing domain model classes/tables in Lua
Date: Tue, 18 Jan 2011 00:56:57 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; x86_64; ; )
References: <AANLkTimZZn48atYrONSNEeZozgQAoL1HCPUkpVewfM4Y@mail.gmail.com>
In-Reply-To: <AANLkTimZZn48atYrONSNEeZozgQAoL1HCPUkpVewfM4Y@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201101180056.57956.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jan 2011 23:52:45 -0000

On Monday, January 17, 2011 11:20:55 pm Gustavo de S=E1 Carvalho Honorato w=
rote:

Hi,
=20
> I've mentioned in previous e-mails that I would like to implement the
> bussiness logic of my application using Lua language because of its
> facilities. However, I would like to access my model classes in Lua
> and C++ in an easy way for both sides. One idea I have for doing this
> is to create wrappers in C++ which delegates all getters/setters and
> methods to the Lua table stored in a Value object inside my wrapper
> class, but I'm having some doubts:

> 1) Do you think that creating this wrappers/delegators is a good
> approach? Any suggestions?

Did you had a look to QtLua MVC classes?

This is what they have been developped for. Item, ItemList... are designed =
to=20
implement a tree structure which can be accessed from both lua and Qt=20
tree/list view. Data is stored in user C++ classes which inherit from Item =
and=20
ItemList. This is really powerfull, view are updated in realtime when you=20
manipulate data from lua. This is the best approach to me because lua scrip=
t=20
is only used to extend the application and is not involved in storing data.=
=20
Support for table/grid structure is still missing.

Other classes allow accessing data stored in lua tables with tree or table=
=20
view. This is less powerfull than the first approach because we have no way=
 to=20
detect changes to lua tables from lua to update the views.

> 2) What is the difference between Value and ValueRef? I suspect that
> Value is a copy of a Lua data, so, if I change something in a Value
> object using C++ code it won't reflect in Lua VM. Using ValueRef it
> will reflect. In this manner, the correct way to implement my wrappers
> is using ValueRef, right?

Value is not a copy, it's stored in the Lua VM.

ValueRef acts as a reference to a lua value in a table (because all lua val=
ues=20
in the vm are in some kind of table). It holds two lua values, the table (o=
r=20
userdata) and the key. When you assign a ValueRef it will write in table[ke=
y].

see http://www.nongnu.org/libqtlua/manual/ValueRef_class_reference.html

> 3) I've started to implement this approach (source in
> http://pastebin.com/UtSepwTT), but I'm stuck with an error. In line
> 62, when I try to read the table size property with  return
> value["size"]; I'm getting the following error: "Can not make value
> reference with lua::nil type as table.". Could you help me?

The ValueRef was instanciated empty, its table value is nil.

=2D-=20
Alexandre



From MAILER-DAEMON Mon Jan 17 20:44:00 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Pf0c4-0004ju-Oc
	for mharc-libqtlua-list@gnu.org; Mon, 17 Jan 2011 20:44:00 -0500
Received: from [140.186.70.92] (port=33764 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Pf0c2-0004jS-3F
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 20:43:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pf0c0-00064b-UV
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 20:43:57 -0500
Received: from mail-gw0-f45.google.com ([74.125.83.45]:35528)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1Pf0c0-00064X-Rp
	for libqtlua-list@nongnu.org; Mon, 17 Jan 2011 20:43:56 -0500
Received: by gwaa12 with SMTP id a12so2252934gwa.4
	for <libqtlua-list@nongnu.org>; Mon, 17 Jan 2011 17:43:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=SNWoGh051e2Anz9QLZ/6TK3NCBicv+ofKNnx5cMug3I=;
	b=hAcXcPaxDdmgvy6Pltf+npFfjSF1gPp1g0r/UUmR0YgjQR/hNlybVJ6QijCy3CoPUH
	xel6yOjsVeahh83gLaHyLm/i8Rw19u/Dw3quzQJOBlp1j8GmWYKoUZqJwf0384WOIniM
	UAKFEFL/nkpVPdJjYkG43cNccV4b9AbW59+7E=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=ASzxZ/4ttNTIe3X8uxQ9lDcljw69OY4MdwBMMU6WLn/2fKlFq54ZUAuNEGccXzCpxs
	UxFYoXC9F/gN9X1h5glBWbNlbsxPb2BUQ8+hcF1hYbMmjMx+pICYIi+ZQI1VGod+IMMF
	sJam78T+3loNCY1bFvx8YjAfOv9KwuCEGcGKI=
MIME-Version: 1.0
Received: by 10.150.141.8 with SMTP id o8mr450766ybd.401.1295315034437; Mon,
	17 Jan 2011 17:43:54 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Mon, 17 Jan 2011 17:43:54 -0800 (PST)
In-Reply-To: <201101180056.57956.alexandre.becoulet@free.fr>
References: <AANLkTimZZn48atYrONSNEeZozgQAoL1HCPUkpVewfM4Y@mail.gmail.com>
	<201101180056.57956.alexandre.becoulet@free.fr>
Date: Mon, 17 Jan 2011 23:43:54 -0200
Message-ID: <AANLkTi=S-8kZm_mjpNdjWOSU-goZORueYEgnnF9-2ezx@mail.gmail.com>
Subject: Re: [Libqtlua-list] Implementing domain model classes/tables in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Jan 2011 01:43:59 -0000

On Mon, Jan 17, 2011 at 9:56 PM, Alexandre Becoulet
<alexandre.becoulet@free.fr> wrote:
> On Monday, January 17, 2011 11:20:55 pm Gustavo de S=E1 Carvalho Honorato=
 wrote:
>
> Hi,
>
>> I've mentioned in previous e-mails that I would like to implement the
>> bussiness logic of my application using Lua language because of its
>> facilities. However, I would like to access my model classes in Lua
>> and C++ in an easy way for both sides. One idea I have for doing this
>> is to create wrappers in C++ which delegates all getters/setters and
>> methods to the Lua table stored in a Value object inside my wrapper
>> class, but I'm having some doubts:
>
>> 1) Do you think that creating this wrappers/delegators is a good
>> approach? Any suggestions?
>
> Did you had a look to QtLua MVC classes?
Yes.
>
> This is what they have been developped for. Item, ItemList... are designe=
d to
> implement a tree structure which can be accessed from both lua and Qt
> tree/list view. Data is stored in user C++ classes which inherit from Ite=
m and
> ItemList. This is really powerfull, view are updated in realtime when you
> manipulate data from lua. This is the best approach to me because lua scr=
ipt
> is only used to extend the application and is not involved in storing dat=
a.
> Support for table/grid structure is still missing.

Unless I'm missing some important point, in my case I think QtLua MVC
does not apply very well. My models need to be presented in many forms
of views (timeline, graphicsview, table, tree, etc). Your application
seems to present, in most of the time, data in tabular or tree format,
right?

>
> Other classes allow accessing data stored in lua tables with tree or tabl=
e
> view. This is less powerfull than the first approach because we have no w=
ay to
> detect changes to lua tables from lua to update the views.
>
>> 2) What is the difference between Value and ValueRef? I suspect that
>> Value is a copy of a Lua data, so, if I change something in a Value
>> object using C++ code it won't reflect in Lua VM. Using ValueRef it
>> will reflect. In this manner, the correct way to implement my wrappers
>> is using ValueRef, right?
>
> Value is not a copy, it's stored in the Lua VM.
>
> ValueRef acts as a reference to a lua value in a table (because all lua v=
alues
> in the vm are in some kind of table). It holds two lua values, the table =
(or
> userdata) and the key. When you assign a ValueRef it will write in table[=
key].
>
> see http://www.nongnu.org/libqtlua/manual/ValueRef_class_reference.html
>
>> 3) I've started to implement this approach (source in
>> http://pastebin.com/UtSepwTT), but I'm stuck with an error. In line
>> 62, when I try to read the table size property with =A0return
>> value["size"]; I'm getting the following error: "Can not make value
>> reference with lua::nil type as table.". Could you help me?
>
> The ValueRef was instanciated empty, its table value is nil.

I didn't understand. I've initialized ValueRef in line 53. Did you notice t=
hat?

>
> --
> Alexandre
>
>
>


From MAILER-DAEMON Tue Jan 18 07:16:23 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PfAU2-0003Xx-Td
	for mharc-libqtlua-list@gnu.org; Tue, 18 Jan 2011 07:16:22 -0500
Received: from [140.186.70.92] (port=54661 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PfATw-0003Wx-Og
	for libqtlua-list@nongnu.org; Tue, 18 Jan 2011 07:16:21 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PfATq-0008GP-8v
	for libqtlua-list@nongnu.org; Tue, 18 Jan 2011 07:16:16 -0500
Received: from mail-gy0-f173.google.com ([209.85.160.173]:33411)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PfATq-0008Fz-1B
	for libqtlua-list@nongnu.org; Tue, 18 Jan 2011 07:16:10 -0500
Received: by gye5 with SMTP id 5so2901664gye.4
	for <libqtlua-list@nongnu.org>; Tue, 18 Jan 2011 04:16:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=5SSv9NEAIaUUdvROrdUT0hSR3ffm5VTd/cFWDng9PGA=;
	b=S+UrqdMRkkJ4mdlCpcYGmTTDx0s+LgpuJOlUaZDgT5Q3Og9YMnA/vs4tg+nPwA0NFl
	FEpfVkzS3Z8pkV5OwxdJD16vyEeTls3B62wSJs9bk9e9TPNYpQrj56dduEkNKpDPZGys
	8xUIWivrRIbv5qft5H6jsQcjZcqY17MJG/cNc=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=MOvLlMaBiYKJZpaHps2Hxs0UuGiqMajBuK/nFsdpvahqmBndBmIlGN685UtM2nCCBk
	/AxQ7Kd9WoiKKZBKreVEogINCLsgvzgZ99/9k0j1tpMrQn0Dbsuhyy8gAL7M2ropDVI0
	+as61y/p9Z8j+7n2afNKMHOoe/J2HNSw5y44I=
MIME-Version: 1.0
Received: by 10.150.139.19 with SMTP id m19mr872166ybd.116.1295352969151; Tue,
	18 Jan 2011 04:16:09 -0800 (PST)
Received: by 10.150.50.2 with HTTP; Tue, 18 Jan 2011 04:16:09 -0800 (PST)
In-Reply-To: <AANLkTik5r_nBuTnn_ut8dnLH9w-geX2MXoRVO595c8xH@mail.gmail.com>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<201101170121.28512.alexandre.becoulet@free.fr>
	<AANLkTinmxb2LOW84BX4ZQG4+4UA_tTpCf9_9R5gULb=-@mail.gmail.com>
	<201101172327.38987.alexandre.becoulet@free.fr>
	<AANLkTik5r_nBuTnn_ut8dnLH9w-geX2MXoRVO595c8xH@mail.gmail.com>
Date: Tue, 18 Jan 2011 10:16:09 -0200
Message-ID: <AANLkTim8fHUKmzbCxwELib6hqJrrMe0nA_4dw+WbpT92@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Jan 2011 12:16:21 -0000

2011/1/17 Gustavo de S=E1 Carvalho Honorato <gustavohonorato@gmail.com>:
> 2011/1/17 Alexandre Becoulet <alexandre.becoulet@free.fr>:
>> 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 ty=
pes
>>> >> > 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 i=
f 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.

>>
>>> > It should not take too long for me to implement, it's just a matter o=
f
>>> > accessing a QMap in the 'default:' section of a switch statement to
>>> > handle dynamically registered types cases. I have precise idea of how
>>> > user callbacks should be implemented and will update the manual with
>>> > examples.
>>
>>> Very good! Thanks! I'm looking forward to this feature. You can count
>>> on me if you need any help.
>>
>> Commited in subversion. Have a look to:
>> http://www.nongnu.org/libqtlua/manual/MetaType_class_reference.html
>
> Great! You are very efficient. One suggestion: the page
> http://www.nongnu.org/libqtlua/manual/node5.html could have a
> reference to this new way of type conversion. What you think?
>
>>
>> --
>> Alexandre
>>
>>
>


From MAILER-DAEMON Fri Jan 21 18:23:59 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PgQKl-0006yD-0b
	for mharc-libqtlua-list@gnu.org; Fri, 21 Jan 2011 18:23:59 -0500
Received: from [140.186.70.92] (port=37563 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PgQKh-0006w4-Hz
	for libqtlua-list@nongnu.org; Fri, 21 Jan 2011 18:23:57 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PgQKU-0007lh-9Z
	for libqtlua-list@nongnu.org; Fri, 21 Jan 2011 18:23:43 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:49294)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PgQKT-0007kn-L0
	for libqtlua-list@nongnu.org; Fri, 21 Jan 2011 18:23:42 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id CA0EC4C804F;
	Sat, 22 Jan 2011 00:23:31 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: Gustavo de =?iso-8859-1?q?S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
Subject: Re: [Libqtlua-list] Implementing domain model classes/tables in Lua
Date: Sat, 22 Jan 2011 00:27:22 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; x86_64; ; )
References: <AANLkTimZZn48atYrONSNEeZozgQAoL1HCPUkpVewfM4Y@mail.gmail.com>
	<201101180056.57956.alexandre.becoulet@free.fr>
	<AANLkTi=S-8kZm_mjpNdjWOSU-goZORueYEgnnF9-2ezx@mail.gmail.com>
In-Reply-To: <AANLkTi=S-8kZm_mjpNdjWOSU-goZORueYEgnnF9-2ezx@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201101220027.22645.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Fri, 21 Jan 2011 23:23:57 -0000

On Tuesday, January 18, 2011 02:43:54 am you wrote:

Hi,

> > This is what they have been developped for. Item, ItemList... are
> > designed to implement a tree structure which can be accessed from both
> > lua and Qt tree/list view. Data is stored in user C++ classes which
> > inherit from Item and ItemList. This is really powerfull, view are
> > updated in realtime when you manipulate data from lua. This is the best
> > approach to me because lua script is only used to extend the application
> > and is not involved in storing data. Support for table/grid structure is
> > still missing.
> 
> Unless I'm missing some important point, in my case I think QtLua MVC
> does not apply very well. My models need to be presented in many forms
> of views (timeline, graphicsview, table, tree, etc). Your application
> seems to present, in most of the time, data in tabular or tree format,
> right?

Qt MVC QModelIndex index are based on x,y coordinates and parent pointer.
How does your view exactly use models?

> >> 3) I've started to implement this approach (source in
> >> http://pastebin.com/UtSepwTT), but I'm stuck with an error. In line
> >> 62, when I try to read the table size property with  return
> >> value["size"]; I'm getting the following error: "Can not make value
> >> reference with lua::nil type as table.". Could you help me?
> > 
> > The ValueRef was instanciated empty, its table value is nil.
> 
> I didn't understand. I've initialized ValueRef in line 53. Did you notice
> that?

I missed that. But I do not understand exactly what you are trying to achieve 
with the ValueRef class this way. You are using the following constructor:

ValueRef(const Value &table, const Value &key);

53 value(state, state.exec_statements("return { size = 10}").first())

This implicitly builds a nil value as first argument:

53 value(Value(state), ...

See
http://www.nongnu.org/libqtlua/manual/Value_class_reference.html#_Value_const_State_ls_

Accessing the ValueRef would do nil[{size=10}] which is what the "Can not make 
value reference with lua::nil type as table." message stands for.

Note that you can build a table value without using exec_statements:

Value t(state, Value::TTable);
t["size"]=10;

If you are trying to get a reference to a value in a lua table (a ValueRef) 
you may use:

http://www.nongnu.org/libqtlua/manual/Value_class_reference.html#_ValueRef_operator_const_Value_key_1
http://www.nongnu.org/libqtlua/manual/State_class_reference.html#_ValueRef_operator_const_Value_key_

Best,

-- 
Alexandre



From MAILER-DAEMON Fri Jan 21 18:37:38 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PgQXy-0001HH-Fc
	for mharc-libqtlua-list@gnu.org; Fri, 21 Jan 2011 18:37:38 -0500
Received: from [140.186.70.92] (port=37207 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PgQXv-0001Fq-1i
	for libqtlua-list@nongnu.org; Fri, 21 Jan 2011 18:37:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PgQXt-00026G-R3
	for libqtlua-list@nongnu.org; Fri, 21 Jan 2011 18:37:34 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:45443)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PgQXt-00025F-50
	for libqtlua-list@nongnu.org; Fri, 21 Jan 2011 18:37:33 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id 3D00C4C8046;
	Sat, 22 Jan 2011 00:37:27 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: Gustavo de =?iso-8859-1?q?S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
Date: Sat, 22 Jan 2011 00:41:17 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; x86_64; ; )
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<AANLkTik5r_nBuTnn_ut8dnLH9w-geX2MXoRVO595c8xH@mail.gmail.com>
	<AANLkTim8fHUKmzbCxwELib6hqJrrMe0nA_4dw+WbpT92@mail.gmail.com>
In-Reply-To: <AANLkTim8fHUKmzbCxwELib6hqJrrMe0nA_4dw+WbpT92@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201101220041.17974.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Fri, 21 Jan 2011 23:37:37 -0000

On Tuesday, January 18, 2011 01:16:09 pm you wrote:
> 2011/1/17 Gustavo de S=E1 Carvalho Honorato <gustavohonorato@gmail.com>:
> > 2011/1/17 Alexandre Becoulet <alexandre.becoulet@free.fr>:
> >> On Monday, January 17, 2011 07:39:37 pm you wrote:
> >>=20
> >> Hi,
> >>=20
> >>> >> > 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.
> >>=20
> >> 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?
> >=20
> > 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.
>=20
> 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 plac=
e=20
to dig.

In the mean time you can register pointers to QObject based classes with tw=
o=20
lines of code as shown on the example. This should be a minor issue unless =
you=20
plan to register a lot of such pointer types. What do you think?

=2D-=20
Alexandre



From MAILER-DAEMON Mon Jan 24 14:09:48 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PhRnQ-0001Is-2d
	for mharc-libqtlua-list@gnu.org; Mon, 24 Jan 2011 14:09:48 -0500
Received: from [140.186.70.92] (port=47891 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PhRnA-0001DE-LI
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:09:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PhRmz-000361-Tz
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:09:32 -0500
Received: from mail-yi0-f45.google.com ([209.85.218.45]:45251)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PhRmz-00035i-RG
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:09:21 -0500
Received: by yie21 with SMTP id 21so1616247yie.4
	for <libqtlua-list@nongnu.org>; Mon, 24 Jan 2011 11:09:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=8zMg7dQ3SaZ8ddfFMEyb9vP2QvKVgAxl560PRr2sHqA=;
	b=aM138XyXaC3YzhgIrd5lXAacA4q8gjl1tEOdltznhWIeODZBWcJXpdIYtV4/wZRHXH
	AhTBEWLxc5Ep3/GHDxqzTtgIHLl0bPbInIUYmN1HaeQbPZ/gZ4nO2H5NAlgyoKKtLbR1
	mMdLG/Xvj36/Oxn2rmHBkcjmCx695J7BiXDXI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=Ailu4cxnGHEoX468MAkDpZIP7BcMeWQPY1k2Lkh3bphmfu4axhMm9W1N6K0d4gUb/i
	UYSxZx9L7ioYdUSRqCPZsLZxh3hKRhJ8OPz6KPAfi7MCBqwpLrd+OGP6K1L7bVxhcHZM
	RpfDjH8IKOgFAm3ubdj3/AQVDi+JChBKk7TjM=
MIME-Version: 1.0
Received: by 10.151.154.3 with SMTP id g3mr5051190ybo.239.1295896160813; Mon,
	24 Jan 2011 11:09:20 -0800 (PST)
Received: by 10.151.99.4 with HTTP; Mon, 24 Jan 2011 11:09:20 -0800 (PST)
Date: Mon, 24 Jan 2011 17:09:20 -0200
Message-ID: <AANLkTikGPEJE+j+mTiG=5bKpmb8gFDjAnBR02_MYvv7X@mail.gmail.com>
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: libqtlua-list@nongnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [Libqtlua-list] Calling method from UserData in Lua
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 24 Jan 2011 19:09:46 -0000

Hi,

I would like to call in Lua code a C++ method of a class which not
inherits from QObject. I know that UserData is designed to do that,
but I could not figure out how to do this using UserData.

Thanks,
Gustavo


From MAILER-DAEMON Mon Jan 24 14:11:09 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PhRoj-000215-Io
	for mharc-libqtlua-list@gnu.org; Mon, 24 Jan 2011 14:11:09 -0500
Received: from [140.186.70.92] (port=49575 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PhRog-0001zi-F3
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:11:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PhRod-0003kI-LB
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:11:06 -0500
Received: from mail-yi0-f45.google.com ([209.85.218.45]:40794)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PhRod-0003k8-Ex
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:11:03 -0500
Received: by yie21 with SMTP id 21so1616936yie.4
	for <libqtlua-list@nongnu.org>; Mon, 24 Jan 2011 11:11:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=MtALoyvUTGF6yJPMrmSXkPdWlT5x9pf7/cmpUkdyS8w=;
	b=AOSNY5hSmlvxL5YqjdQIPqTKzl/JHu20Z4bIxur8YE1F7L45LWP0JEAE1JSBeRg69L
	9svJNRPIP7IdWWBfwheOEAmNQUhOOSKsp+a07WnkkCfqpQ5d2Bmg7kucnBLJuyjxMYK7
	kqbr+NYGA6+xze9nadcTMK5ylBE7gYDJmZmQ0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=B/aI7IZAKveGfapWR980A23rXSkMvirN9q+0UMHHp+ZG93WxldhQMwz5M99UO3AZNA
	GNaSRm3V8pywXOJFda2SZ1cO9lIVaEDr4UAnj52qes6YQkh2Dk3zypS479mlef721uDS
	ODc8fwhBKaaEccw2mRDL3WwkFYH05/lYo4cXE=
MIME-Version: 1.0
Received: by 10.151.88.36 with SMTP id q36mr4822131ybl.353.1295896262905; Mon,
	24 Jan 2011 11:11:02 -0800 (PST)
Received: by 10.151.99.4 with HTTP; Mon, 24 Jan 2011 11:11:02 -0800 (PST)
In-Reply-To: <201101220041.17974.alexandre.becoulet@free.fr>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<AANLkTik5r_nBuTnn_ut8dnLH9w-geX2MXoRVO595c8xH@mail.gmail.com>
	<AANLkTim8fHUKmzbCxwELib6hqJrrMe0nA_4dw+WbpT92@mail.gmail.com>
	<201101220041.17974.alexandre.becoulet@free.fr>
Date: Mon, 24 Jan 2011 17:11:02 -0200
Message-ID: <AANLkTin0EmCRyhu4y1o7Z32=d4cYsiudqpijNNSZn1O-@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 24 Jan 2011 19:11:07 -0000

2011/1/21 Alexandre Becoulet <alexandre.becoulet@free.fr>:
> On Tuesday, January 18, 2011 01:16:09 pm you wrote:
>> 2011/1/17 Gustavo de S=E1 Carvalho Honorato <gustavohonorato@gmail.com>:
>> > 2011/1/17 Alexandre Becoulet <alexandre.becoulet@free.fr>:
>> >> On Monday, January 17, 2011 07:39:37 pm you wrote:
>> >>
>> >> Hi,
>> >>
>> >>> >> > I guessed that. The problem is once registered as a Qt meta typ=
e,
>> >>> >> > 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 o=
r
>> >> 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 pl=
ace
> 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 unles=
s you
> plan to register a lot of such pointer types. What do you think?
>
> --
> Alexandre
>
>


From MAILER-DAEMON Mon Jan 24 14:15:28 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PhRsu-0004L3-3G
	for mharc-libqtlua-list@gnu.org; Mon, 24 Jan 2011 14:15:28 -0500
Received: from [140.186.70.92] (port=60096 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PhRss-0004JG-1X
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:15:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PhRsq-0005jV-KY
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:15:25 -0500
Received: from mail-gx0-f173.google.com ([209.85.161.173]:35541)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gustavohonorato@gmail.com>) id 1PhRsq-0005jO-Hw
	for libqtlua-list@nongnu.org; Mon, 24 Jan 2011 14:15:24 -0500
Received: by gxk28 with SMTP id 28so1616044gxk.4
	for <libqtlua-list@nongnu.org>; Mon, 24 Jan 2011 11:15:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=y4dJjO5AKFJwawRzJdUM+gZtajid9Me/rLkhqHuVDmM=;
	b=ZvyL2niJW0FsD82I918L7UkLY1Np/W84HzdR82428b03gepis1XoVqgRpGaryNjqSz
	CmhEyu4t4VV2kfvkD+Q2FPXecXHOVg+3by8ruiqvFBkoC36rr9pf3o+fzmRTq8giZ6s1
	jPOzCcWzl7ben8jD1aSEWrznrhGyeQCvtw5sg=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=GX7rVljvtaDCwSvhOX07TwB55N3jw3bCimGZFbHC4LSI5w0dy8jr7WC0zSfUoEYcBW
	OTiXGjgnePSg/K3H6Ej8meR/j08SZP3yOhyOuPew8m8AnuuaBtVnVhb/iFYJ6nwhhnT9
	oNqR11jgHd9/bP3DdFG5mpY71v2cN6bJ+jRUk=
MIME-Version: 1.0
Received: by 10.151.88.36 with SMTP id q36mr4827306ybl.353.1295896523808; Mon,
	24 Jan 2011 11:15:23 -0800 (PST)
Received: by 10.151.99.4 with HTTP; Mon, 24 Jan 2011 11:15:23 -0800 (PST)
In-Reply-To: <AANLkTin0EmCRyhu4y1o7Z32=d4cYsiudqpijNNSZn1O-@mail.gmail.com>
References: <AANLkTikRX19eVCSx5VnAzBK_nMezvXZ2RVstGVT-gtVS@mail.gmail.com>
	<AANLkTik5r_nBuTnn_ut8dnLH9w-geX2MXoRVO595c8xH@mail.gmail.com>
	<AANLkTim8fHUKmzbCxwELib6hqJrrMe0nA_4dw+WbpT92@mail.gmail.com>
	<201101220041.17974.alexandre.becoulet@free.fr>
	<AANLkTin0EmCRyhu4y1o7Z32=d4cYsiudqpijNNSZn1O-@mail.gmail.com>
Date: Mon, 24 Jan 2011 17:15:23 -0200
Message-ID: <AANLkTinkQtdAXcNVR2sFUJN1cG+QN53EPAMThkiiEyHy@mail.gmail.com>
Subject: Re: [Libqtlua-list] Accessing QObject inside a property in Lua
From: =?ISO-8859-1?Q?Gustavo_de_S=E1_Carvalho_Honorato?=
	<gustavohonorato@gmail.com>
To: Alexandre Becoulet <alexandre.becoulet@free.fr>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: libqtlua-list@nongnu.org
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Mon, 24 Jan 2011 19:15:27 -0000

2011/1/24 Gustavo de S=E1 Carvalho Honorato <gustavohonorato@gmail.com>:
> 2011/1/21 Alexandre Becoulet <alexandre.becoulet@free.fr>:
>> On Tuesday, January 18, 2011 01:16:09 pm you wrote:
>>> 2011/1/17 Gustavo de S=E1 Carvalho Honorato <gustavohonorato@gmail.com>=
:
>>> > 2011/1/17 Alexandre Becoulet <alexandre.becoulet@free.fr>:
>>> >> On Monday, January 17, 2011 07:39:37 pm you wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >>> >> > I guessed that. The problem is once registered as a Qt meta ty=
pe,
>>> >>> >> > MainWindow* and QObject* are just different meta types. Qt met=
a
>>> >>> >> > 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 p=
lace
>> to dig.
>
> Have you tried qVariantCanConvert<QObject*>() ? It seems to be what we
> are looking for.

Another suggestion from Qt mailing list was:

QObject *object =3D myVariant.value<QObject*>();
if (object)
   QMetaObject *metaObject =3D object->metaObject();

>
>>
>> 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 unle=
ss you
>> plan to register a lot of such pointer types. What do you think?
>>
>> --
>> Alexandre
>>
>>
>


From MAILER-DAEMON Sun Jan 30 16:07:57 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PjeV3-0003Mp-Ng
	for mharc-libqtlua-list@gnu.org; Sun, 30 Jan 2011 16:07:57 -0500
Received: from [140.186.70.92] (port=33654 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PjeV2-0003MN-4D
	for libqtlua-list@nongnu.org; Sun, 30 Jan 2011 16:07:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PjeV1-0008MG-2g
	for libqtlua-list@nongnu.org; Sun, 30 Jan 2011 16:07:55 -0500
Received: from smtp4-g21.free.fr ([212.27.42.4]:58533)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexandre.becoulet@free.fr>) id 1PjeV0-0008Lr-JC
	for libqtlua-list@nongnu.org; Sun, 30 Jan 2011 16:07:55 -0500
Received: from ganymede.localnet (unknown [82.228.245.190])
	by smtp4-g21.free.fr (Postfix) with ESMTP id 4DEE94C8198
	for <libqtlua-list@nongnu.org>; Sun, 30 Jan 2011 22:07:48 +0100 (CET)
From: Alexandre Becoulet <alexandre.becoulet@free.fr>
To: libqtlua-list@nongnu.org
Subject: Re: [Libqtlua-list] Calling method from UserData in Lua
Date: Sun, 30 Jan 2011 22:10:30 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; x86_64; ; )
References: <AANLkTikGPEJE+j+mTiG=5bKpmb8gFDjAnBR02_MYvv7X@mail.gmail.com>
In-Reply-To: <AANLkTikGPEJE+j+mTiG=5bKpmb8gFDjAnBR02_MYvv7X@mail.gmail.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201101302210.30362.alexandre.becoulet@free.fr>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 212.27.42.4
X-BeenThere: libqtlua-list@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: libqtlua-list.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/libqtlua-list>
List-Post: <mailto:libqtlua-list@nongnu.org>
List-Help: <mailto:libqtlua-list-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/libqtlua-list>,
	<mailto:libqtlua-list-request@nongnu.org?subject=subscribe>
X-List-Received-Date: Sun, 30 Jan 2011 21:07:57 -0000

On Monday, January 24, 2011 08:09:20 pm Gustavo de S=E1 Carvalho Honorato w=
rote:

Hi,

> I would like to call in Lua code a C++ method of a class which not
> inherits from QObject. I know that UserData is designed to do that,
> but I could not figure out how to do this using UserData.

You first need to reimplement UserData functions to allow table access and=
=20
enumeration, so that your class methods can be listed and accessed from lua=
=2E=20
Then you need to return some kind of lua callable objects. This is already=
=20
implemented in UserObject and Function classes.

=2D-=20
Alexandre



