Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instead of reloading a whole project, reset data sources #5343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nirvn
Copy link
Member

@nirvn nirvn commented Jun 17, 2024

ATM, we force reload a whole project to apply credentials for as few as a single layer. Let's be more surgical about things :)

@m-kuhn , keen to hear what you think of this alternative approach.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/core/layertreemodel.cpp Show resolved Hide resolved
@qfield-fairy
Copy link
Collaborator

@@ -83,7 +85,15 @@ bool QFieldAppAuthRequestHandler::handleLayerLogins()
}
else
{
emit reloadEverything();
const QList<QgsMapLayer *> mapLayers = QgsProject::instance()->mapLayers().values();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we inject the QgsProject instead (as a property)?
It's already here: https://github.com/opengisch/QField/blob/master/src/core/qgismobileapp.cpp#L264 and the appauthrequesthandler is created in the same source file, so could easily be injected.

{
if ( !mapLayer->isValid() && mapLayer->dataProvider() )
{
mapLayer->setDataSource( mapLayer->source(), mapLayer->name(), mapLayer->dataProvider()->name() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, that forces a reload of the datasource?
If that's the goal of this line, a comment would be justified, that's not immediately clear for a reader.

@m-kuhn
Copy link
Member

m-kuhn commented Jun 17, 2024

A good thing 👍
Hard to tell the risks of it, needs proper testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants