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. [Solved] Making a QRect that surrounds other QRects
QtWS25 Last Chance

[Solved] Making a QRect that surrounds other QRects

Scheduled Pinned Locked Moved General and Desktop
qgraphicsitemboundingrectqrect
4 Posts 2 Posters 1.7k 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.
  • J Offline
    J Offline
    Joel Bodenmann
    wrote on 11 Sept 2015, 21:14 last edited by Joel Bodenmann 9 Dec 2015, 10:02
    #1

    Is there a quick way to create a QRect that surrounds other, specified, QRect items?

    Context: I have to implement the boundingRect() method in a QGraphicsItem class. The class contains two things: A QPainterPath for a symbol and a QRect for text that goes next to the symbol. In the boundingRect() method I need to return a QRect that surrounds the two.

    Do I need to calculate the position and the size of the rectangle manually or is there some easy magic way of doing this?

    Industrial process automation software: https://simulton.com
    Embedded Graphics & GUI library: https://ugfx.io

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on 11 Sept 2015, 21:29 last edited by
      #2

      @Joel-Bodenmann said:

      QRectF QRectF::united ( const QRectF & rectangle ) const

      1 Reply Last reply
      1
      • A Offline
        A Offline
        alex_malyu
        wrote on 11 Sept 2015, 21:48 last edited by
        #3

        @Joel-Bodenmann said:
        Just do not be confused. You need QRectF not QRect
        virtual QRectF boundingRect () const = 0

        1 Reply Last reply
        1
        • J Offline
          J Offline
          Joel Bodenmann
          wrote on 12 Sept 2015, 01:14 last edited by
          #4

          That's exactly what I have been looking for! I definitely searched for the wrong terms.
          Thank you for your help. Very appreciated.

          Industrial process automation software: https://simulton.com
          Embedded Graphics & GUI library: https://ugfx.io

          1 Reply Last reply
          0

          4/4

          12 Sept 2015, 01:14

          • Login

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