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 get colour value at particular position on custom widget
Qt 6.11 is out! See what's new in the release blog

How to get colour value at particular position on custom widget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k Views 1 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.
  • Pradeep P NP Offline
    Pradeep P NP Offline
    Pradeep P N
    wrote on last edited by
    #1

    I have written a custom widget using paint event and QPainter inheriting from QWidget. I am drawing tiny random circles with different colors in that widget. I am getting X and Y position using mouse event. How do i get the color which is present at position X and Y . I do not want to use graphics framework to draw tiny circles.

    Pradeep Nimbalkar.
    Upvote the answer(s) that helped you to solve the issue...
    Keep code clean.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      You can render your current widget to an image, then get the pixel information from the image.

      1 Reply Last reply
      0
      • Pradeep P NP Offline
        Pradeep P NP Offline
        Pradeep P N
        wrote on last edited by
        #3

        I have drawn it on QPixmap. So is there a way to get it.. ?

        Pradeep Nimbalkar.
        Upvote the answer(s) that helped you to solve the issue...
        Keep code clean.

        1 Reply Last reply
        1

        • Login

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