Results 1 to 19 of 19

Thread: Moving from Qwt 5.2 to 6.0 (trunk)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Moving from Qwt 5.2 to 6.0 (trunk)

    I was trying to move my code from Qwt 5.2 to the trunk which is to be the new 6.0, and the axis labels are either left or right justified instead of centered.

    Is this by design or did I do something wrong?

    Thanks,
    Joey

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

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    Quote Originally Posted by bigjoeystud View Post
    Is this by design or did I do something wrong?
    And what is it what you did ?

    Uwe

  3. #3
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    ?????

    I ported the code from 5.2 to the trunk, just like I said. However, the QwtTexts are being justified to the edges of the axes. If I surround the text with center tags, I get the old output. Maybe there is a float that should be an int or vice versa either in my code or elsewhere or is that a new default?

    Also, in qwt_symbol.h, the setSize takes two ints, but the default argument is a float.

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

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    Are you talking about labels in the Qwt examples ? If yes I can tell you it is not intended and it doesn't happen on my box.
    If not it's not enough to write that you have ported some code - you have to tell us about the code you have now.

    Uwe

  5. #5
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    Try this:

    In plot.cpp in the bode example, line 60:

    - setAxisTitle(QwtPlot::yRight, "Phase [deg]");
    + setAxisTitle(QwtPlot::yRight, "<i>Phase [deg]</i>");

    Once making this change, the right axis is now justified along the top of the axis on my box since it now uses the RichText API.

    Is that by design or not, or does this only happen on my Linux box?

    Thanks,
    Joey

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

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    Ok, now I can see it: the rich text label is aligned left, while the plain text label is centered.

    The alignment of the plain text label is like expected, but the position of the rich text is not intended. Looks like I had removed the code, that sets the alignment alignment flags internally by accident.

    Fixed in SVN,
    Uwe

  7. #7
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    One more problem noticed in printing, but I'm at a loss for how to duplicate this problem in the example codes.

    I'm printing a grid of QwtPlots and there can be more of them than there is room so I scale the coordinate system with painter.setWindow (rect). At least, that is what I used in the past (5.2). With the new version, I use either painter.setWindow (rect.toRect ()) or painter.setWindow (rect.toAlignedRect ()), and I get all the boxes (axes/scaling/etc) and the line plots looking correct; however, any spectrograms (i.e. rasters) are not printed correctly. It is like it is not scaling the rasters since I see what looks like the top of the raster unscaled.

    Does that make sense? Any ideas on what I could look at to try and fix this?

    Thanks,
    Joey

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

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    Qwt 6-x uses a double based render engine, what makes it possible to print with a scaled painter without losing precision for all vector graphics. Raster data is different as any scaled image is worse compared to an image that is rendered in device coordinates.

    That's why QwtPlotRasterItem fiddles around with the painter transformation, using it for finding the bounding rect of the image but disabling it for rendering the image and painting it later. Guess there is a bug in combination with QPainter::setWindow.

    The code can be found in QwtPlotRasterItem::draw. The important code is the calculation of paintRect and all lines with the painter.

    Uwe

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

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    I had a look at the code myself: instead of resetTransform a identity transformation has to be set if I don't want to kill a setWindow transformation.

    Fixed in SVN trunk,
    Uwe

  10. #10
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    Darn! Found another problem... (but all of the fixes in SVN thus far are great!)

    I am plotting some rasters which have a Y range of 0 to 180 with nine values of Y and I would normally see the image filled throughout the box. With the new version, I see only eight values of the Y and the top row is blank!

    In debugging, I see that in QwtPlotRasterItem::draw, the yMap and canvasRect are correct, but when it gets to computing imageArea, the rectangle now starts at 0.847, rather than 0. When it gets into QwtPlotSpectrogram::renderImage, the scale interval is 0.847 to 180.847. Thus, when it is in my code (subclass of QwtRasterData::value) looking for the data, the Y value being sent in is 180.847 which is outside the range so that is why it is drawing the blank region.

    I don't see this on all my plots, just the cases where I am going from 0 to something. At least I think that is the common denominator.

    Any ideas?

    Thanks,
    Joey

  11. #11
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Moving from Qwt 5.2 to 6.0 (trunk)

    A final note - commenting out the paintRect.translate(tr.m31(), tr.m32()); line in QwtPlotRasterItem::draw fixes this problem. However, taking this line out makes the inner/outer ticks not line up correctly when printing. Not good either... Other ideas welcome.

    Joey
    Last edited by bigjoeystud; 13th May 2010 at 17:14. Reason: New Info!

Similar Threads

  1. Moving of QGraphicsItem
    By Erlendhg in forum Qt Programming
    Replies: 17
    Last Post: 5th November 2013, 15:04
  2. qgl_use_font error during compilation of QT git trunk
    By manuels in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2010, 14:05
  3. Moving a QTcpSocket around
    By chaoticbob in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2010, 21:14
  4. Replies: 2
    Last Post: 15th February 2010, 15:07
  5. Moving a QMdiSubWindow
    By philwinder in forum Qt Programming
    Replies: 1
    Last Post: 2nd November 2008, 10:12

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.