On 6 February 2018 at 06:33, Denis Rouzaud <[email protected]> wrote: > Hi all, > > I am wondering what's the best way to warn the user when reading XML is not > going as expected i.e. when an error is encountered. > > Here is the path to the method I want to warn from: > > QgsProject::read > QgsProject::readProjectFile > QgsProject::_getMapLayers > QgsProject::addLayer > QgsMapLayer::readLayerXML > QgsVectorLayer::readXML > QgsVectorLayer::readSymbology > QgsEditFormConfig::readXML > > I see only two solutions: > > 1. Using success return value and some errorMessage. > This is partly done in readSymbology but totally incomplete (always returns > true and errorMessage are not used at all...) > It would require a finer grain than bool as return value (info / warning / > error, probably). > It would probably be a a list of error messages. > > 2. Emitting signals. > But that means bring the connections all the way up to the project by > connecting and disconnecting the map layers and all other objects during the > way down. Moreover, many config object are not QObjects. > > To me solution 1. sounds nicer but is an API break. > The small feature I am working on is targeted to 3.2 si I would need to set > this in place prior to release. > > Is there somehting I am missing?
For those following at home, Denis and I had a quick brainstorm and settled on the idea of instead extending QgsReadWriteContext to add error collection/reporting there. Nyall _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
