Results 1 to 9 of 9

Thread: Paint Rect visible on Drag to crop image coordinate

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Paint Rect visible on Drag to crop image coordinate

    Quote Originally Posted by jacek View Post
    Maybe it will be easier if you use QRubberBand?
    Crasch app maybe QRubberBand and paintEvent is not able to live together....
    && i wand to display text pixel size to crop.... on top of rectange

    i test now to split action & switch paint mode...

    && QWidget:aintEngine ()


    typedef enum
    {
    DRAW_SELECTION,
    MOVE_SELECTION,
    MOVE_TOP_LEFT_CORNER,
    MOVE_TOP_RIGHT_CORNER,
    MOVE_BOTTOM_LEFT_CORNER,
    MOVE_BOTTOM_RIGHT_CORNER,
    MOVE_LEFT_SIDE,
    MOVE_RIGHT_SIDE,
    MOVE_TOP_SIDE,
    MOVE_BOTTOM_SIDE,
    SCALE_SELECTION,
    DRAW_LINE,
    KEYBOARD_CTRL,
    NO_EFFECT
    } DRAG_MODE;

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Paint Rect visible on Drag to crop image coordinate

    I have it .... the solution is only repaint on mouseMoveEvent && define each DRAG_MODE
    on widged....

    Qt Code:
    1. typedef enum
    2. {
    3. DRAW_SELECTION,
    4. SCALE_SELECTION,
    5. DRAW_LINE,
    6. DRAW_START,
    7. NO_EFFECT
    8. } DRAG_MODE;
    9.  
    10.  
    11.  
    12. void Image_Operator::mouseMoveEvent(QMouseEvent *e)
    13. {
    14. currentDragMode = DRAW_LINE;
    15. mouseRELEASEPoint = e->pos();
    16. if (display.isNull()) {
    17. return;
    18. }
    19.  
    20. /* remove draw lines */
    21. Load_Actual_Desktop(); /* widget size setting e resolution X11 */
    22. int hi_now = widgetSize.height();
    23. int wi_now = widgetSize.width();
    24.  
    25. QPoint topLeft( 0 , 0 );
    26. QPoint bottomRight( widgetSize.width() , widgetSize.height() );
    27. QRect areanow( topLeft, bottomRight );
    28. repaint(areanow);
    29. }
    30.  
    31. if ( currentDragMode == DRAW_SELECTION || currentDragMode == DRAW_LINE ) {
    32. OneWorkImage = selectionIMAGE;
    33. pen.setWidth( bordershade );
    34. pen.setColor( shapepicture );
    35. painter.setPen( pen);
    36. painter.drawRect(selectionOutIMAGE);
    37. /* ................... draw rectangle or only image display on the Zoom Widged && resizable ....*/
    To copy to clipboard, switch view to plain text mode 

    source & PrtScn avaiable....

    http://www.qtforum.de/forum/viewtopic.php?t=3885

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Paint Rect visible on Drag to crop image coordinate

    Please try to express yourself with simple and full sentences, without "...", abreviations, images or code that distract the reader from the topic of your post - especially if you're not sure of your English language skills. Using such constructions makes your post barely readable and hardly understandable. So does including a large amount of code that doesn't add anything to the conversation. If you have to paste some of your code, please remove parts that are not important.

    I have to say that after reading this thread a few times I still don't know what the problem was. The thread title suggests problems with cropping an image, but the thread content implies something completely different.

  4. The following user says thank you to wysota for this useful post:

    patrik08 (17th March 2007)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.