Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to easily recognize searched item in a dense QGraphicsScene?
Forum Updated to NodeBB v4.3 + New Features

How to easily recognize searched item in a dense QGraphicsScene?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 382 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tushu
    wrote on last edited by
    #1

    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 marker

    But I do not know, how to implement it , which Qt class should I use etc.

    JonBJ 1 Reply Last reply
    0
    • T tushu

      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 marker

      But I do not know, how to implement it , which Qt class should I use etc.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @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.

      T 1 Reply Last reply
      0
      • JonBJ JonB

        @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.

        T Offline
        T Offline
        tushu
        wrote on last edited by tushu
        #3

        @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.

        JonBJ 1 Reply Last reply
        0
        • T tushu

          @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.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @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

          T 1 Reply Last reply
          3
          • JonBJ JonB

            @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

            T Offline
            T Offline
            tushu
            wrote on last edited by
            #5

            @JonB
            Thanks. It worked. !

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved