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. Bounding rect for lines

Bounding rect for lines

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 989 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.
  • L Offline
    L Offline
    Lachrymology
    wrote on last edited by
    #1

    Hi all,

    has Qt in QGraphicsScene an object which is able to keep track of a bounding rect, which only covers the objects' paths instead of the entire outline?

    I want to have a tooltip over a path which contains three lines, but I want to have the bounding rect only over the tree lines, not over the entire rect they are creating.

    The nearest solution would be for me currently to paint each line as a single object and put them in an own container to solve this problem. Do you have another solution for such a feature?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Lachrymology
      wrote on last edited by
      #2

      To illustrate it: I'm talking about something like this.
      0_1551686579012_bRect.png

      JonBJ 1 Reply Last reply
      0
      • L Offline
        L Offline
        Lachrymology
        wrote on last edited by
        #3

        Solved it by overwriting the "shape" function and using within QPainterPathStroker and QPainterPath.

        1 Reply Last reply
        2
        • L Lachrymology

          To illustrate it: I'm talking about something like this.
          0_1551686579012_bRect.png

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

          @Lachrymology
          While you're waiting for someone who knows better than I:

          You'll never get "a bounding rect" for this, as what you want is not a rect! It's 3 rects. And there doesn't seem to be any single call somehow returning 3 rects in a list....

          So I think either you set the tooltip for each separate line, or you go via https://doc.qt.io/archives/qt-4.8/qgraphicsscenehelpevent.html where you get the QPoint of the mouse and then calculate whether that intersects with each of your lines to decide whether to show the tooltip?

          EDIT Your latest post just crossed with mine, you may know better than I do!

          1 Reply Last reply
          2

          • Login

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