how to select a particular area in qwidget using mouseevents
how to select a particular area in qwidget using mouseevents
Here's a one approach:
press event:
- store the event position
move event:
- draw a rectangle from press point to move event position
release event:
- apply the selection
- invalidate press point
J-P Nurmi
How to draw a rectangle in application
Use QPainter. Here's an example from the docs:
Replace QPainter::drawText() with QPainter::drawRect()..Qt Code:
void SimpleExampleWidget::paintEvent() { paint.setPen( Qt::blue ); paint.drawText( rect(), AlignCenter, "The Text" ); }To copy to clipboard, switch view to plain text mode
J-P Nurmi
thank you its working properly![]()
Bookmarks