Results 1 to 20 of 23

Thread: setRasterOp Equivalent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setRasterOp Equivalent

    Quote Originally Posted by wysota View Post
    Change the two QPoint members into a list or vector of points and don't null out the vector on mouse release. Then in the paint event iterate over the list and draw all the points.
    SOmething like this. But unlucky

    Qt Code:
    1. void setRasterOpTest::mousePressEvent( QMouseEvent *e ){
    2. m_vector<<e->pos();
    3. }
    4.  
    5. void setRasterOpTest::mouseMoveEvent( QMouseEvent *e ){
    6. m_vector<<e->pos();
    7. update();
    8. }
    9.  
    10. void setRasterOpTest::mouseReleaseEvent(QMouseEvent *e){
    11. m_vector<<e->pos();
    12. update();
    13. }
    14.  
    15. void setRasterOpTest::paintEvent(QPaintEvent *e){
    16. //... (do regular stuff here)
    17.  
    18. if( m_vector.count() <= 0 )
    19. return;
    20.  
    21. QPainter painter;
    22. painter.begin(this);
    23.  
    24. painter.setPen( Qt::black );
    25. painter.drawLines ( m_vector );
    26. painter.end();
    27. }
    To copy to clipboard, switch view to plain text mode 

    Also let me explain, I dont want a continuous flow of line as in scribble example but only straight line. I start from a point and when I release the mouse a straight line should be drawn. Then again I click on some other point and when I release the mouse another straight line should be drawn.

    Thanks for your understanding
    Last edited by vermarajeev; 29th March 2007 at 13:36.

Similar Threads

  1. Replies: 2
    Last Post: 23rd April 2006, 01:02
  2. what's the equivalent with DPtoLP in windows
    By cocalele in forum Qt Programming
    Replies: 6
    Last Post: 1st March 2006, 06:57
  3. make install equivalent in qmake ...
    By momesana in forum Newbie
    Replies: 3
    Last Post: 20th February 2006, 21:46
  4. PostMessage() across process boundaries equivalent
    By TheKedge in forum Qt Programming
    Replies: 9
    Last Post: 27th January 2006, 00:02

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.