Results 1 to 3 of 3

Thread: Draw marker during drag and rectangle during zoom

  1. #1
    Join Date
    Apr 2011
    Location
    Bayreuth, Bayern
    Posts
    24
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Draw marker during drag and rectangle during zoom

    Hello!
    I am new to Qwt and I have a persistent problem which I cannot solve, so I decided to ask for help.

    I plot a histogram and set markers in form of vertical lines on it. These markers divide my original histogram into many small colored histograms. I derive from QwtPlotPicker and override widgetMouse..Event() functions in order to catch mouse events and place markers on mouse click. Now, if I want to move an existing marker, I use the same MyPlotPicker instance as before. I store the start and end position of the mouse drag and move the marker into the new position. But I cannot persuade MyPlotPicker to draw a temporary marker during dragging. I tried drawing a marker on-the-fly in void MyPlotPicker::widgetMouseMoveEvent( QMouseEvent * event), but it did not work out.

    I also use MyPlotPicker for zooming. If a drag is performed during right-button mouse click pressed, I interpret it as zooming into the selected area. Here, again: I do not know how to draw a rectangular selection in the area where I want to zoom into. I have tried reloading drawRubberBand, but the function seems to never be called. Any idea as to what am I doing wrong?

    I use the Qwt 6.0.0 RC5 under Windows with Qt 4.6.1.

    Thank you in advance!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Draw marker during drag and rectangle during zoom

    I have added the itemeditor example to SVN trunk. It demonstrates how to use the new QwtPlotOverlay class for building some sort of graphical editors.

    Maybe it helps,
    Uwe

  3. #3
    Join Date
    Apr 2011
    Location
    Bayreuth, Bayern
    Posts
    24
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draw marker during drag and rectangle during zoom

    Thank you very much! Your example has helped me implement my own marker dragger.

Similar Threads

  1. How to draw a QPainter rectangle over Widgets
    By sureshdharmadurai in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2011, 11:17
  2. Replies: 1
    Last Post: 7th December 2010, 07:49
  3. How to draw rectangle with moveable edge
    By sagirahmed in forum Qt Programming
    Replies: 4
    Last Post: 2nd July 2010, 07:21
  4. Replies: 1
    Last Post: 3rd November 2009, 23:26
  5. how to draw columns in QPainter's rectangle
    By jyoti in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2007, 11:50

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.