How to easily recognize searched item in a dense QGraphicsScene?
-
I have a QGraphicsScene with many QGraphicsItem like circle, rectangle, polylines, arc etc.
Every QGraphicsItem has a name. And I have a Search feature which highlights searched items using that name. When scene contains fewer items, highlighted items are seen properly.But when scene contains many items ( 100 + ) then identifying the highlighted item becomes difficult. For that I need to scroll up - down or left - right to check where is that highlighted item is.
So I want my highlighted item to be easily recognizable.
For that I was suggested, some approach like
Take searched item in front
Or
Add some markerBut I do not know, how to implement it , which Qt class should I use etc.
-
I have a QGraphicsScene with many QGraphicsItem like circle, rectangle, polylines, arc etc.
Every QGraphicsItem has a name. And I have a Search feature which highlights searched items using that name. When scene contains fewer items, highlighted items are seen properly.But when scene contains many items ( 100 + ) then identifying the highlighted item becomes difficult. For that I need to scroll up - down or left - right to check where is that highlighted item is.
So I want my highlighted item to be easily recognizable.
For that I was suggested, some approach like
Take searched item in front
Or
Add some markerBut I do not know, how to implement it , which Qt class should I use etc.
@tushu
I really find it hard to understand what you are doing/actually asking.....And I have a Search feature which highlights searched items using that name.
Do you mean you search by name and it takes time to find that name, because you look at every graphics item?
For that I need to scroll up - down or left - right to check where is that highlighted item is.
What does this mean? If you have an item "highlighted" but it's not in view you can always adjust to bring it e.g. into the centre of the view.
So I want my highlighted item to be easily recognizable.
That is just what "highlighting" does for you.
-
@tushu
I really find it hard to understand what you are doing/actually asking.....And I have a Search feature which highlights searched items using that name.
Do you mean you search by name and it takes time to find that name, because you look at every graphics item?
For that I need to scroll up - down or left - right to check where is that highlighted item is.
What does this mean? If you have an item "highlighted" but it's not in view you can always adjust to bring it e.g. into the centre of the view.
So I want my highlighted item to be easily recognizable.
That is just what "highlighting" does for you.
@JonB Thanks for your reply.
I have a search feature, in which I search items from scene using it's name.
What search feature does ?
It searches the item in a scene and once the item is found in the scene it highlights that item. (Item's border becomes dark)But if scene contains many items, then sometimes it becomes difficult to see the highlighted item. ( Imagine , I have zoomed in and seeing limited portion of scene ) So I need to scroll left - right or up - down in scene to locate where the highlighted item is ?
So I want my search feature should highlight that item and should take me to that highlighted searched item so that I dont need to scroll in scene.
I think Google map is a good example. Once you entered your desired location, it takes you to there, so you need not to scroll left - right.
-
@JonB Thanks for your reply.
I have a search feature, in which I search items from scene using it's name.
What search feature does ?
It searches the item in a scene and once the item is found in the scene it highlights that item. (Item's border becomes dark)But if scene contains many items, then sometimes it becomes difficult to see the highlighted item. ( Imagine , I have zoomed in and seeing limited portion of scene ) So I need to scroll left - right or up - down in scene to locate where the highlighted item is ?
So I want my search feature should highlight that item and should take me to that highlighted searched item so that I dont need to scroll in scene.
I think Google map is a good example. Once you entered your desired location, it takes you to there, so you need not to scroll left - right.
@tushu said in How to easily recognize searched item in a dense QGraphicsScene?:
should take me to that highlighted searched item so that I dont need to scroll in scene.
Then so far as I can determine your explanation about searching by name is superfluous and just clouds the issue. You are just asking how to ensure a
QGraphicsItem
is visible in the view without needing to scroll:
https://doc.qt.io/qt-6/qgraphicsview.html#centerOn-2
https://doc.qt.io/qt-6/qgraphicsview.html#ensureVisible-2 -
@tushu said in How to easily recognize searched item in a dense QGraphicsScene?:
should take me to that highlighted searched item so that I dont need to scroll in scene.
Then so far as I can determine your explanation about searching by name is superfluous and just clouds the issue. You are just asking how to ensure a
QGraphicsItem
is visible in the view without needing to scroll:
https://doc.qt.io/qt-6/qgraphicsview.html#centerOn-2
https://doc.qt.io/qt-6/qgraphicsview.html#ensureVisible-2