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

Tags fixes #1398

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Tags fixes #1398

wants to merge 2 commits into from

Conversation

vladisslav2011
Copy link
Contributor

Make it possible to edit tag name inline both in the "Bookmarks" dock and "Edit tags" popup dialog window.
Update tag list in the "Bookmarks" dock when tags are changed (added, deleted, renamed, changed color) in the "Edit tags" popup dialog window.
Refuse to create duplicate tags by renaming.
Refuse to edit "Untagged" tag name.
Fix small memory leaks, spotted while implementing this fixes.

@argilo
Copy link
Member

argilo commented Feb 4, 2025

Sorry for the delay in looking at this.

In general, the user interface here looks good. A couple observations:

  • The "Rename" function is also accessible from the "New bookmark" dialog, but doesn't seem to work properly there. It creates a new tag, and does not rename the tag for existing bookmarks.
  • In the "Change Bookmark Tag" dialog (and the "New bookmark" dialog), double clicking on a tag to rename it also toggles the checkbox, which is a bit confusing. Perhaps the double-click action could be removed? (Unless there's some better way to separate the two actions.)

@argilo
Copy link
Member

argilo commented Feb 4, 2025

After renaming a tag from within the Bookmarks dock, the following is printed at the console:

QAbstractItemView::closeEditor called with an editor that does not belong to this view

After creating a new tag from within the Bookmarks dock, the following is printed:

QAbstractItemView::closeEditor called with an editor that does not belong to this view
QAbstractItemView::commitData called with an editor that does not belong to this view
QAbstractItemView::closeEditor called with an editor that does not belong to this view

Is that indicative of a bug? I don't think I've seen these messages appear before.

@argilo argilo added the feature label Feb 4, 2025
@vladisslav2011
Copy link
Contributor Author

Thanks for a review.

The "rename" function in a "New bookmark" dialog needs more work. I'll either fix it or remove it from a context menu and update the PR.

  • double clicking on a tag to rename

Interesting. I didn't expect double clicking to start tag renaming, so disabling this trigger (or just making it not change the checkbox state) may be a good choice. I'll check this and update the PR.

QAbstractItemView::closeEditor called with an editor that does not belong to this view

This warning means that the method is called on a detached editor. It should not harm anything.

I don't think I've seen these messages appear before.

Maybe you were using Qt < 6.4.

I'll try to find a way to silence these warnings.

@vladisslav2011
Copy link
Contributor Author

vladisslav2011 commented Feb 4, 2025

I've fixed the "New bookmark" dialog issues.
The QAbstractItemView::closeEditor called with an editor that does not belong to this view warning is not reproducible on my machine, so I'll install ubuntu 24.04 and make some tests later. I think, it may be fixed by converting void DockBookmarks::updateTags() to a slot and calling it via Qt::QueuedConnection instead of default Qt::DirectConnection...

@argilo
Copy link
Member

argilo commented Feb 4, 2025

Maybe you were using Qt < 6.4.

I've been using Qt 6.4 for quite a while. What I meant is that I haven't seen this error message prior to this PR. I'll see how things look with your updates.

@vladisslav2011
Copy link
Contributor Author

vladisslav2011 commented Feb 4, 2025

I think, the warning (and possible use after free) is fixed now. No warning under Ubuntu 24.04, but it was not tested under Windows/MacOS.
Should I squash commits into a single commit?
Or is it better to squash it into two commits: memory leak fixes and tag renaming feature?

@argilo
Copy link
Member

argilo commented Feb 4, 2025

Or is it better to squash it into two commits: memory leak fixes and tag renaming feature?

That sounds good, and should make the code easier to review.

Avoid leaking taglist menu each time it is shown
Avoid leaking QDialog each time it is shown
Support tag renaming in all 3 places: new bookmark dialog, bookmark tags
dialog and tag selection list in a bookmarks dock.
Immediately update tags/bookmarks everywhere when tag name/color is
changed.
Prevent renaming "Untagged" tag and accidental creation of duplicate tags by
renaming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants