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
Forum Updated to NodeBB v4.3 + New Features

Fill shape like paint bucket tool

Scheduled Pinned Locked Moved Unsolved General and Desktop
fillpaintscene
4 Posts 2 Posters 1.7k Views 2 Watching
  • 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.
  • AlvaroSA Offline
    AlvaroSA Offline
    AlvaroS
    wrote on 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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

      AlvaroSA 1 Reply Last reply
      1
      • SGaistS SGaist

        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 ?

        AlvaroSA Offline
        AlvaroSA Offline
        AlvaroS
        wrote on 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
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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

          • Login

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