Results 1 to 9 of 9

Thread: Problem with vertical scales in Qwt 6.0.1

  1. #1
    Join Date
    May 2014
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question Problem with vertical scales in Qwt 6.0.1

    Hi All.

    I'm using two QwtScaleWidgets as scales for a QGraphicsView. When the visible sceneRect of the view changes I send signals to update the Qwt scales.
    This works for the horizontal scale, but not for the vertical one and I'm not sure why. The vertical scale is off on the lower and upper bound.
    The two scale widget are handled exactly the same, except that QwtScaleDraw::Alignment is different. Spacings and Margins are 0, Scaling is linear.

    The last lines of application code involved in the QwtScaleWidget-derived scale widgets are:
    Qt Code:
    1. scaleTransformation = new QwtScaleTransformation(QwtScaleTransformation::Linear);
    2. setScaleDiv(scaleTransformation, scaleEngine->divideScale(lowerBound, upperBound, nBigTicks, nSmallTicks);
    To copy to clipboard, switch view to plain text mode 
    The values passed there for lowerBound and upperBound are indeed correct (Example: -992.955, 217.5), but the resulting scale widget is not:
    awerfearfgerg.jpg
    (you can see the scale starts a ~190 and ends at ~960)

    Any ideas on what to try?

    Best Regards,

    K.

    Edit: I'm using Qt 4.8.0, but tried 4.8.6 too, should that matter...
    Last edited by kiro; 27th May 2014 at 12:06.

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

    Default Re: Problem with vertical scales in Qwt 6.0.1

    A qDebug of the parameters and the result of divideScale would help.

    Uwe

  3. #3
    Join Date
    May 2014
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with vertical scales in Qwt 6.0.1

    Hi. Thanks for answering.

    divideScale() arguments:
    lowerBound -993.01
    upperBound 217.609
    nBigTicks 18
    nSmallTicks 10

    QwtScaleDiv:
    interval().minValue() -993.01
    interval().maxValue() 217.609
    isValid() true
    range() 1210.62
    lowerBound() -993.01
    upperBound() 217.609

    Is that enough information? The values look quite ok to me... :/

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

    Default Re: Problem with vertical scales in Qwt 6.0.1

    You didn't post the position of the ticks ( at least a major tick at 200 seems to be missing on your screenshot ). The missing alignment of the boundaries indicates, that the QwtScaleEngine::Floating attribute is enabled.

    Uwe

  5. #5
    Join Date
    May 2014
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with vertical scales in Qwt 6.0.1

    The ticks positions seem ok:
    Major(-900, -800, -700, -600, -500, -400, -300, -200, -100, 0, 100, 200)

    Medium (-950, -850, -750, -650, -550, -450, -350, -250, -150, -50, 50, 150)
    Minor (-990, -980, -970, -960, -940, -930, -920, -910, -890, -880, -870, -860, -
    840, -830, -820, -810, -790, -780, -770, -760, -740, -730, -720, -710, -690, -68
    0, -670, -660, -640, -630, -620, -610, -590, -580, -570, -560, -540, -530, -520,
    -510, -490, -480, -470, -460, -440, -430, -420, -410, -390, -380, -370, -360, -
    340, -330, -320, -310, -290, -280, -270, -260, -240, -230, -220, -210, -190, -18
    0, -170, -160, -140, -130, -120, -110, -90, -80, -70, -60, -40, -30, -20, -10, 1
    0, 20, 30, 40, 60, 70, 80, 90, 110, 120, 130, 140, 160, 170, 180, 190, 210)

    I didn't explicitly set the Floating attribute, and I tried disabling it: m_pScaleEngine->setAttribute(QwtScaleEngine::Floating, false);
    but that didn't change anything...

  6. #6
    Join Date
    May 2014
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with vertical scales in Qwt 6.0.1

    Any more ideas on where to look?

    K.

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

    Default Re: Problem with vertical scales in Qwt 6.0.1

    Are you sure that your layout code is o.k. and the scale widget is not cut off - you could use a style sheet with a frame to verify your layout.
    If you are able to demonstrate the issue in a small test application you can upload it here and I will have a look at it.

    Uwe

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

    kiro (2nd June 2014)

  9. #8
    Join Date
    May 2014
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with vertical scales in Qwt 6.0.1

    That might be the right track. There were some negative margins set in the code to stretch the scale to the complete widget I didn't see before. I removed them, but now the scale does not fill the whole widget...
    scales.png
    I tried setting all spacings, margins and content margins of the layouts/widgets containing the scale to 0, and set:
    Qt Code:
    1. setSpacing(0);
    2. setMargin(0);
    3. setMinBorderDist(0, 0);
    4. setStyleSheet("background-color: yellow");
    To copy to clipboard, switch view to plain text mode 
    In the constructor of the class derived from QwtScaleWidget.

  10. #9
    Join Date
    May 2014
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with vertical scales in Qwt 6.0.1

    I have now set the border (not the minborder) dist of the QwtScaleWidget to 0,0 using:
    Qt Code:
    1. setSpacing(0);
    2. setMargin(0);
    3. setBorderDist(0, 0);
    To copy to clipboard, switch view to plain text mode 
    which fixed the scale not fitting the widget. After adjust some more (damn!) layout margins it is working perfectly!

    Thanks helping and putting a Qwt-noob in the right direction!

    Kind regards,

    K.

    P.S. Can you mark this thread as solved/closed somehow?
    Last edited by kiro; 2nd June 2014 at 14:01. Reason: updated contents

Similar Threads

  1. MAC ONLY- Vertical Scroll problem with QTableWidget
    By user_mail07 in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2013, 11:42
  2. Replies: 0
    Last Post: 8th March 2013, 03:40
  3. Replies: 3
    Last Post: 14th April 2012, 10:44
  4. Replies: 3
    Last Post: 4th January 2011, 04:15
  5. Problem with scales
    By fear in forum Qwt
    Replies: 2
    Last Post: 5th May 2008, 23:18

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.