[QGIS-Developer] How to access QgisApp::instance() from a core class
Schmetzer, Tobias
Tobias.Schmetzer at zae-bayern.de
Sat Mar 5 06:06:34 PST 2022
Hello everyone,
I would like to access QgisApp::instance() (src/app/qgisapp.cpp) from a provider like QgsOgrProvider::extent() (src/core/providers/ogr/qgsogrprovider.cpp.
Yet I cannot include "qgisapp.h" into the provider.
When looking for this information I found some inactivating preprocessor code block comments like this one (qgswfsdataitems.cpp):
#if 0
// TODO: how to emit message from provider (which does not know about QgisApp)
QgisApp::instance()->messageBar()->pushMessage( tr( "Cannot copy style" ),
errorMsg,
Qgis::MessageLevel::Critical, messageTimeout() );
#endif
Does anybody know what is the idea to access the current QgisApp::instance() from outside the QgisApp realm?
Best regards, Tobias
--
ZAE Bayern
Dipl.-Ing. Tobias Schmetzer
Systementwicklung | Systems Engineering
Bereich Energiespeicherung | Division Energy Storage
Walther-Meißner-Straße 6
85748 Garching
Tel.: +49 89 329442-65
Fax: +49 89 329442-12
Mobil | Cell: +49 151 56964756
tobias.schmetzer at zae-bayern.de
https://www.zae-bayern.de
ZAE Bayern
Bayerisches Zentrum für Angewandte Energieforschung e. V. | Bavarian Center for Applied Energy Research
Vorstand | Board: Dr. Andreas Hauer (Vorsitzender | Chairman), Dr. Hans-Peter Ebert
Sitz | Registered Office: Würzburg
Registergericht | Register Court: Amtsgericht Würzburg
Registernummer | Register Number: VR 1386
Hinweise zum Datenschutz unter https://www.zae-bayern.de/datenschutz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220305/53323de0/attachment.html>
More information about the QGIS-Developer
mailing list