fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.87k stars 814 forks source link

Find parts in sketch should prioritize exact matches, selections should keep internal order. #4117

Closed KjellMorgenstern closed 1 week ago

KjellMorgenstern commented 4 months ago

Problem

If "Find parts in sketch" matches multiple parts, then it is quite random which part will be shown in the Inspector.

For example, if you Look for LED1 , but there is a LED11 , it will select both LEDs and might list LED11 in the Inspector. It is quite difficult to get to LED1.

Proposed Solution

The search should prefer exact matches of the title. Also, the selectItems method should not use a QSet, since this will result in a random order of items.

This might also pose a problem when Undo/Redo operations on selections are not executed in a predictable order.

KjellMorgenstern commented 4 months ago

Patterns (QList -> QSet -> QList for removing possible duplicates from lists should be avoided. I'll try DuplicateTracker (https://www.kdab.com/fast-duplicate-tracking/ , https://quick-bench.com/q/AayMXp5ojP-U9pSTYPOyJTcTOTQ )

It is faster, and we can keep the original order.

KjellMorgenstern commented 1 week ago

Duplicates are now avoided, "find in sketch" results should now be more intuitive.