mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-23 00:05:43 -04:00
do not write logs before QgsApplication instace
because otherwise it creates a QgsProject without a QgsApplication and translation won't work anymore because it cannot connect the signal to the slot this fixes #20561
This commit is contained in:
parent
dcba25501f
commit
f3943f5877
@ -430,6 +430,9 @@ APP_EXPORT
|
|||||||
#endif
|
#endif
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
|
//log messages written before creating QgsApplicatoin
|
||||||
|
QStringList preApplicationLogMessages;
|
||||||
|
|
||||||
#ifdef Q_OS_MACX
|
#ifdef Q_OS_MACX
|
||||||
// Increase file resource limits (i.e., number of allowed open files)
|
// Increase file resource limits (i.e., number of allowed open files)
|
||||||
// (from code provided by Larry Biehl, Purdue University, USA, from 'MultiSpec' project)
|
// (from code provided by Larry Biehl, Purdue University, USA, from 'MultiSpec' project)
|
||||||
@ -866,11 +869,11 @@ int main( int argc, char *argv[] )
|
|||||||
{
|
{
|
||||||
if ( !QgsSettings::setGlobalSettingsPath( globalsettingsfile ) )
|
if ( !QgsSettings::setGlobalSettingsPath( globalsettingsfile ) )
|
||||||
{
|
{
|
||||||
QgsMessageLog::logMessage( QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
|
preApplicationLogMessages << QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QgsMessageLog::logMessage( QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
|
preApplicationLogMessages << QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,6 +973,10 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
QgsApplication myApp( argc, argv, myUseGuiFlag );
|
QgsApplication myApp( argc, argv, myUseGuiFlag );
|
||||||
|
|
||||||
|
//write the log messages written before creating QgsApplicatoin
|
||||||
|
for ( QString const &preApplicationLogMessage : preApplicationLogMessages )
|
||||||
|
QgsMessageLog::logMessage( preApplicationLogMessage );
|
||||||
|
|
||||||
// Settings migration is only supported on the default profile for now.
|
// Settings migration is only supported on the default profile for now.
|
||||||
if ( profileName == QLatin1String( "default" ) )
|
if ( profileName == QLatin1String( "default" ) )
|
||||||
{
|
{
|
||||||
|
@ -384,8 +384,8 @@ QgsProject::QgsProject( QObject *parent )
|
|||||||
connect( mLayerStore.get(), &QgsMapLayerStore::allLayersRemoved, this, &QgsProject::removeAll );
|
connect( mLayerStore.get(), &QgsMapLayerStore::allLayersRemoved, this, &QgsProject::removeAll );
|
||||||
connect( mLayerStore.get(), &QgsMapLayerStore::layersAdded, this, &QgsProject::layersAdded );
|
connect( mLayerStore.get(), &QgsMapLayerStore::layersAdded, this, &QgsProject::layersAdded );
|
||||||
connect( mLayerStore.get(), &QgsMapLayerStore::layerWasAdded, this, &QgsProject::layerWasAdded );
|
connect( mLayerStore.get(), &QgsMapLayerStore::layerWasAdded, this, &QgsProject::layerWasAdded );
|
||||||
if ( QgsApplication::instance() )
|
Q_ASSERT( QgsApplication::instance() );
|
||||||
connect( QgsApplication::instance(), &QgsApplication::requestForTranslatableObjects, this, &QgsProject::registerTranslatableObjects );
|
connect( QgsApplication::instance(), &QgsApplication::requestForTranslatableObjects, this, &QgsProject::registerTranslatableObjects );
|
||||||
connect( mLayerStore.get(), static_cast<void ( QgsMapLayerStore::* )( const QList<QgsMapLayer *> & )>( &QgsMapLayerStore::layersWillBeRemoved ),
|
connect( mLayerStore.get(), static_cast<void ( QgsMapLayerStore::* )( const QList<QgsMapLayer *> & )>( &QgsMapLayerStore::layersWillBeRemoved ),
|
||||||
[ = ]( const QList<QgsMapLayer *> &layers )
|
[ = ]( const QList<QgsMapLayer *> &layers )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user