Re: [QGIS-Developer] QGIS 3 itemById should return subclassed item

2018-02-12 Thread SIGéal
Thanks for your answers, it helps to workaround... waiting for an 
upstream fix.


--
Christophe

Le 13/02/2018 à 00:28, Chris Crook a écrit :

Hi Nyall

Thanks so much for the pointer (idea that is, not C++ pointer) .. I'll give it 
a go

Cheers
Chris

From: QGIS-Developer [qgis-developer-boun...@lists.osgeo.org] on behalf of 
Nyall Dawson [nyall.daw...@gmail.com]
Sent: 13 February 2018 10:36
To: SIGéal
Cc: qgis-developer
Subject: Re: [QGIS-Developer] QGIS 3 itemById should return subclassed item

On 13 February 2018 at 05:51, SIGéal <sig...@sigeal.com> wrote:

Hi,

This code used to work in QGIS 2.x.

lblTitle = myComposition.getComposerItemById('title')
lblTitle.setText('New Title')

However, in QGIS 2.99, myLayout.itemById('title') returns this error :

'QgsLayoutItem' object has no attribute 'setText'

See discussion at
http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



This message contains information, which may be in confidence and may be 
subject to legal privilege. If you are not the intended recipient, you must not 
peruse, use, disseminate, distribute or copy this message. If you have received 
this message in error, please notify us immediately (Phone 0800 665 463 or 
i...@linz.govt.nz) and destroy the original message. LINZ accepts no 
responsibility for changes to this email, or for any attachments, after its 
transmission from LINZ. Thank You.


___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] QGIS 3 itemById should return subclassed item

2018-02-12 Thread Chris Crook
Hi Nyall

Thanks so much for the pointer (idea that is, not C++ pointer) .. I'll give it 
a go

Cheers
Chris

From: QGIS-Developer [qgis-developer-boun...@lists.osgeo.org] on behalf of 
Nyall Dawson [nyall.daw...@gmail.com]
Sent: 13 February 2018 10:36
To: SIGéal
Cc: qgis-developer
Subject: Re: [QGIS-Developer] QGIS 3 itemById should return subclassed item

On 13 February 2018 at 05:51, SIGéal <sig...@sigeal.com> wrote:
> Hi,
>
> This code used to work in QGIS 2.x.
>
> lblTitle = myComposition.getComposerItemById('title')
> lblTitle.setText('New Title')
>
> However, in QGIS 2.99, myLayout.itemById('title') returns this error :
>
> 'QgsLayoutItem' object has no attribute 'setText'

See discussion at
http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



This message contains information, which may be in confidence and may be 
subject to legal privilege. If you are not the intended recipient, you must not 
peruse, use, disseminate, distribute or copy this message. If you have received 
this message in error, please notify us immediately (Phone 0800 665 463 or 
i...@linz.govt.nz) and destroy the original message. LINZ accepts no 
responsibility for changes to this email, or for any attachments, after its 
transmission from LINZ. Thank You.
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] QGIS 3 itemById should return subclassed item

2018-02-12 Thread Nyall Dawson
On 13 February 2018 at 05:51, SIGéal  wrote:
> Hi,
>
> This code used to work in QGIS 2.x.
>
> lblTitle = myComposition.getComposerItemById('title')
> lblTitle.setText('New Title')
>
> However, in QGIS 2.99, myLayout.itemById('title') returns this error :
>
> 'QgsLayoutItem' object has no attribute 'setText'

See discussion at
http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] QGIS 3 itemById should return subclassed item

2018-02-12 Thread SIGéal

Hi,

This code used to work in QGIS 2.x.

|lblTitle =myComposition.getComposerItemById('title')|||lblTitle|.setText('New 
Title')|

|However, in QGIS |2.99, myLayout.itemById('title') returns this error :

|'QgsLayoutItem' object has no attribute 'setText'|

This problem is related to the following issue :
https://issues.qgis.org/issues/17152

The following workaround still works :
https://github.com/inasafe/inasafe/blob/develop/safe/report/processors/default.py#L54

Can this be corrected in QGIS 3.0 ?

--
Christophe

Le 28/11/2017 à 14:45, SIGéal a écrit :
print(lblTitle) gives "0x029B1435FC18>"

as suggested the error message.
--
Christophe

Le 28/11/2017 à 14:25, SIGéal a écrit :

Weird : lblTitle.type() returns "65639"...
--
Christophe

Le 28/11/2017 à 11:47, Matthias Kuhn a écrit :


I guess there's a problem with the %ConvertToSubClassCode in the sip 
file.


What does lblTitle.type() give?

Matthias


On 11/28/2017 11:22 AM, Etienne Trimaille wrote:
We have this problem with QGIS 2.18 too in our plugin: 
https://github.com/inasafe/inasafe/issues/4271


We could fix the problem with a hint from Martin, we have this 
function as a workaround:

https://github.com/inasafe/inasafe/blob/develop/safe/report/processors/default.py#L54
It works well. It would be nice to know if it's a bug in QGIS.

Etienne

2017-11-28 11:06 GMT+01:00 SIGéal >:


Hi devs,

This code used to work in QGIS 2.x.

|lblTitle 
=myComposition.getComposerItemById('title')|||lblTitle|.setText('New Title')|

|However, it doesn't anymore in QGIS |2.99.
Instead it returns this error :

|'QgsComposerItem' object has no attribute 'setText'|||

--
Christophe



___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org

List info:
https://lists.osgeo.org/mailman/listinfo/qgis-developer

Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-developer





___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer




___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer




___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer




___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer