[Qgis-developer] How to stopediting/rollback in a plugin before changing the project-file

bjsvwpfe Michael.Pfeiffer at bd.so.ch
Fri Dec 5 10:16:46 EST 2008


Thanks for the help Marco.
Seems to be better now. When opening a new project layerWillBeRemoved is
sent now.
But there are still some problems and a few new problems.
The new problems:
- Now there is no dialog anymore when trying to open a new project
- there is a qgis warning in the console saying Warning:
QMetaObject::connectSlotsByName: No matching signal for
on_mActionMoveItemsToBottom() 
I don't know if this depends on the changes you made.

the remaining problems:
- I can call the layer after listening to the SIGNAL now. For example the
method name gives back the correct name of the layer correct.
But I can't do rollBack or commitChanges. They give back False and the
Editing tools are still active in the toolbar thus there is no layer in the
new project.

regards,

Michael


> Ok, this looks like a bug to me.
> In r9743 there is a change such that layerWillBeRemoved is also sent from 
> QgsMapLayerRegistry::removeAllMapLayers()
> 
> Regards,
> Marco
> 
> On Friday 05 December 2008 14:44:22 bjsvwpfe wrote:
>> Hi Martin,
>>
>> > What about using layerWillBeRemoved signal from QgsMapLayerRegistry?
>>
>> thanks for your answer. I've already tried layerWillBeRemoved.
>> But it seems that after clicking the Discard-Button SIGNAL removedAll()
>> is
>> sent by QgsMapLayerRegistry.
>> And after this signal all layers in the QgsMapLayerRegistry have been
>> deleted. layerWillBeRemoved works very good when I delete one layer but
>> when changing the project removedAll() is sent and I get the following
>> error: RuntimeError: underlying C/C++ object has been deleted
>>
>> Any other hints?
>>
>> Best regards
>>
>> Michael
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-stopediting-rollback-in-a-plugin-before-changing-the-project-file-tp20848621p20855935.html
Sent from the qgis-developer mailing list archive at Nabble.com.



More information about the Qgis-developer mailing list