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. Correct way to allow the user to highlight a region of interest on an image using the mouse
Qt 6.11 is out! See what's new in the release blog

Correct way to allow the user to highlight a region of interest on an image using the mouse

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 963 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.
  • I Offline
    I Offline
    isaacEnrique
    wrote on last edited by
    #1

    Greetings .

    I am implementing a custom widget that displays an image and has several buttons and other elements.

    I want to allow the user to highlight area of ​​interest in the image using the mouse (similar to that used in image management programs like MS Paint) . To this end, I have reimplemented methods :

    mousePressEvent ( QMouseEvent * event)
    mouseReleaseEvent ( QMouseEvent * event)
    mouseMoveEvent ( QMouseEvent * event)
    paintEvent ( QPaintEvent * event)

    Roughly what I do with these functions is to draw on the image , in the area marked with the mouse , a dotted rectangle (yellow in this case) . Actually , I think it generally works well , my question is on two related aspects :

    • Is what I am doing the best way to do the task I described above (ie , I paint one more rectangle on an image in an area marked with the mouse ) ?

    • I want the dotted lines that form the rectangle were less thick, saw a little more elongated and have more space between them.

    Here , when I speak of "thickness" I specifically mean the vertical thickness of the ( 2) horizontal lines and the horizontal thickness of the ( 2) vertical lines forming the sides of the rectangle .

    Thanks in advance for any help and / or suggestions.

    Isaac Pérez
    Programming is understanding.

    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