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. Fill shape like paint bucket tool
QtWS25 Last Chance

Fill shape like paint bucket tool

Scheduled Pinned Locked Moved Unsolved General and Desktop
fillpaintscene
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.
  • A Offline
    A Offline
    AlvaroS
    wrote on 14 Jun 2016, 08:39 last edited by AlvaroS
    #1

    Hello everyone:

    First of all thanks a lot for readint this post and being able to help.

    I have a scene with four lines which represent a square.

    I would like to fill the square in blue for example when I click inside the square with the mouse (like the paint tool "bucket").

    how can I do that?

    thanks a lot.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 Jun 2016, 22:00 last edited by
      #2

      Hi,

      One possibility would be to add a QGraphicsRectItem of the color you want in the desired quadrant.

      Another possibility would be to have a custom paint event that handles the four quadrants delimited by your lines.

      But first, what is the purpose of that scene ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply 16 Jun 2016, 08:16
      1
      • S SGaist
        15 Jun 2016, 22:00

        Hi,

        One possibility would be to add a QGraphicsRectItem of the color you want in the desired quadrant.

        Another possibility would be to have a custom paint event that handles the four quadrants delimited by your lines.

        But first, what is the purpose of that scene ?

        A Offline
        A Offline
        AlvaroS
        wrote on 16 Jun 2016, 08:16 last edited by
        #3

        @SGaist Hello! thanks for replying!!

        In my scene I load somw lines which represent some squares or rectangles...
        So with a bucket tool I would like to fill these squares and rectangles just clicking inside them.

        Could you put a little example of code to help me please?

        thanks a lot

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 16 Jun 2016, 20:42 last edited by
          #4

          How are you loading these lines ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          1/4

          14 Jun 2016, 08:39

          • Login

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