Results 1 to 8 of 8

Thread: QwtPlotShapeItem critical paint error (filling differ from contour pen)

  1. #1
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question QwtPlotShapeItem critical paint error (filling differ from contour pen)

    Hello @all.

    I have used the QwtPlotShapeItem with the following program code:
    QColor color(225,46,28,58);

    QPainterPath Path;
    this->PaintCircle(&Path,5, QPointF(0,0));

    QwtPlotShapeItem *Item = new QwtPlotShapeItem( "Shape Name" );
    Item->setItemAttribute( QwtPlotItem::Legend, true );
    Item->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    Item->setShape( Path );
    Item->setPen( color );

    Item->setBrush( color );
    Item->attach( Plot );
    QwtShapteItem.jpg


    With this code i get a shape like in the attached picture.
    --> The shape filling differ from contour pen.

    Can anybody help me to solve this problem?

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

    Default Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    All I can see is that your code is calling some PaintCircle method to create the QPainterPath.

    Uwe

  3. #3
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    The PaintCircle method creates a circle with QPainterPath.

    Code:
    path.addEllipse ( QPointF(0,0), 5, 5 )
    This painterpath i am setting as shape in an object of the class QwtPlotShapeItem.
    Item->setShape( Path );
    This shape item i am attaching to the plot.
    Item->attach( Plot );

    The problem i have is, that the contour of the path don't fit to the filling of the shape.
    This problem can be observed in the attached picture.

    Thanks for help.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,258
    Thanked 862 Times in 811 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    Quote Originally Posted by vnuss View Post
    The PaintCircle method creates a circle with QPainterPath.
    Your screenshot shows something at coordinates, where a circle with a radius of 5.0 and a center at 0.0 will never be !

    But ignoring this: QwtPlotShapeItem does nothing beside translating the coordinates of the painter path from plot into widget coordinates forwarding it to QPainter::drawPath. With which type of paint engine does this problem happen ?

    Uwe

    PS: an easy workaround might be draw with a brush, but without pen ( item->setPen( Qt::NoPen ) ).

  5. #5
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    Screenshot:
    I have zoomed into the plot, till i see the contour / pen difference.

    Radius of 5 was a value for an example.


    I am working with qt verson 4.8.5 and qwt version 6.1.



    Thanks for the workaround, but in my case i couldn't use that, because i need both, contour and filling.

    Can you reproduce this problem?


    Zoom is realised with:
    QwtPlotMagnifier *magnifier = new QwtPlotMagnifier( Plot->canvas() );
    magnifier->setMouseButton( Qt::NoButton );

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,258
    Thanked 862 Times in 811 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    I am working with qt verson 4.8.5 and qwt version 6.1.:
    The paint engine depends on the operating system, f.e raster on Windows. On X11 you have the option between native ( = X11 ) and raster ( default since Qt 4.8 ).
    What is your environment ?

    Can you reproduce this problem?
    Upload a minimal compilable demo showing the issue. Please use axis ranges, where it happens without having to zoom in/out.

    Uwe

  7. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,258
    Thanked 862 Times in 811 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    O.k I have checked the issue with the itemeditor example and I can confirm the bug for a pen width <= 1 with Qt 4.8/raster and Qt5.1/raster. Qt 4.7/raster or Qt4.8/X11 are o.k.
    Seems to be one more of those bugs that have been introduced recently to the raster paint engine ( see Qt bug tracker ). Add a bug report if you can't find one already.

    If a pen width > 1 is acceptable for your application you can try this as a workaround., another option might be to downgrade Qt to the version before the bug has been introduced.

    Uwe

  8. The following user says thank you to Uwe for this useful post:

    vnuss (14th August 2013)

  9. #8
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: QwtPlotShapeItem critical paint error (filling differ from contour pen)

    Ok. Thank you for help.

Similar Threads

  1. Qt-Creator 2.3.0 README and .pro files Differ in version checks
    By hypnotic401 in forum Installation and Deployment
    Replies: 0
    Last Post: 8th September 2011, 19:19
  2. Replies: 1
    Last Post: 30th August 2011, 03:01
  3. Safety critical systems and qt
    By yagabey in forum Qt Programming
    Replies: 2
    Last Post: 8th April 2009, 15:11
  4. Some critical "QtWebKit" doubts
    By crazymoonboy in forum Newbie
    Replies: 1
    Last Post: 19th September 2008, 00:56
  5. Using Qt 4 For Mission Critical Project
    By ball in forum Qt Programming
    Replies: 8
    Last Post: 10th March 2006, 21:41

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.