Results 1 to 7 of 7

Thread: replot() performance

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: replot() performance

    Thanx a lot spitfire,
    its great help
    The vertical marker is now slaved to the x axis. And as suggested by you i am able to add a circle , the position of which can be varied using x and y values.
    However there is some problem regarding the size of the circle. The maximum size of the circle can be equal to the width of the Vertical line and to make circle noticeable i have to increase the size of the vertical bar. As a result the vertical bar becomes wider and hides the significant portion of the graph. when i try to just increase the size of the circle without increasing the size of vertical bar, the circle is clipped and only a portion of it is visible on the bar.
    I need to display a thin vertical bar with a noticeable circle as shown in your demo pic.
    Kindly suggest how to achieve this.

    Regards
    Raghav

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 106 Times in 103 Posts

    Default Re: replot() performance

    Look at paintEvent() in my example.
    You get thin line by drawing a line from top to bottom (not by setting a background or anything).
    Then you draw a circle using full width of the widget.
    This way you can adjust size of the circle by changing width of the widget.

    Qt Code:
    1. void LineMarker::paintEvent( QPaintEvent* e )
    2. {
    3. int middle = this->width()/2;
    4. QPainter p( this );
    5. p.setBrush( Qt::NoBrush );
    6. p.setPen( this->palette().foreground().color() ); // change pen width here if you want wider line
    7.  
    8. p.drawLine( middle, 0, middle, this->height() ); // here you draw the thin lne using default pen (about 1px wide)
    9.  
    10. p.setBrush( Qt::white );
    11. p.drawEllipse( QPoint( middle, this->elipsePosY ), middle-1, middle-1 ); // here you draw the circle with radius = width/2
    12. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: replot() performance

    Thanx for the help.
    It worked

    Raghav

Similar Threads

  1. Replot dinamic curve.
    By Zikoel in forum Qwt
    Replies: 2
    Last Post: 24th October 2011, 09:50
  2. replot in Qwt Zoomer
    By ruzik in forum Qwt
    Replies: 2
    Last Post: 22nd September 2011, 18:42
  3. how to get zoomer to replot
    By kja in forum Newbie
    Replies: 3
    Last Post: 17th November 2010, 07:15
  4. how to accelerate the replot?
    By rambo83 in forum Qwt
    Replies: 6
    Last Post: 17th March 2010, 11:11
  5. how to speed up the replot?
    By rambo83 in forum Qwt
    Replies: 4
    Last Post: 16th December 2009, 11:51

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.