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

add setCurrentNode to qgslayertreeview #58822

Closed

Conversation

ViperMiniQ
Copy link
Contributor

QgsLayerTreeView has a method (setCurrentLayer) for setting the QgsLayerNode as active in the tree by passing the layer to it.

There is no method for selecting groups the same way, even though the method setCurrentLayer finds the QgsLayerTreeNode and passes it to a function which selects the node.

2 new methods are added:

setCurrentNode - a general way of setting active nodes, which both setCurrentGroup and setCurrentLayer will call. Also, since a layerTreeView.selectedNodes() method returns selected nodes, it would make sense to have a method for selecting them as well.

setCurrentGroup - to have an exact way of setting active groups alongside active layers, even though maybe having setCurrentNode only would be ideal. Removing setCurrentLayer would not make sense now, so adding this as well.

Would close #47337

@github-actions github-actions bot added this to the 3.40.0 milestone Sep 20, 2024
Copy link

github-actions bot commented Sep 20, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit f836363)

@nyalldawson nyalldawson added the API API improvement only, no visible user interface changes label Sep 21, 2024
@nyalldawson
Copy link
Collaborator

I think we should drop the redundant setCurrentGroup method, just to keep the API from becoming cluttered. Otherwise +1

@ViperMiniQ
Copy link
Contributor Author

Figured as much, wasn't sure.

Removed setCurrentGroup.

@ViperMiniQ ViperMiniQ changed the title add setCurrentNode, setCurrentGroup to qgslayertreeview add setCurrentNode to qgslayertreeview Sep 22, 2024
@nyalldawson
Copy link
Collaborator

@ViperMiniQ this looks good, it's just the failing code format checks which need fixing now

Copy link

github-actions bot commented Oct 9, 2024

The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Oct 9, 2024
@nyalldawson
Copy link
Collaborator

Superseded by #58822

@github-actions github-actions bot removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API improvement only, no visible user interface changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a method to pyqgis to set group as an active node in layer tree
2 participants