Results 1 to 6 of 6

Thread: QwtScale and QwtPlot scale inconsistency.

  1. #1
    Join Date
    Jan 2010
    Location
    Ankara - TURKEY
    Posts
    30
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtScale and QwtPlot scale inconsistency.

    Hi All,

    I have custom QwtPlot plugin and I add 3 of them in one widget but after application starts Qwtscale and QwtPlot's canvas size doesn't alignment horizontally as you can see from video. But after I double click the canvas which triggers opening another dialog on screen by show method, this inconsitency automatically resolved and align each edge.

    I want to learn what operation triggerd by show method of another dialog or doubleclicking event, so my expected alignment can be achived? Do you suspect any of problem? Why my plugins scale's alignment is changing or scale's number which has positioned on the edge clipped?

    Thanks in advance.
    Regards.

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

    Default Re: QwtScale and QwtPlot scale inconsistency.

    The layout of the plot widgets is recalculated in QwtPlot::updateLayout.

    Uwe

  3. #3
    Join Date
    Jan 2010
    Location
    Ankara - TURKEY
    Posts
    30
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtScale and QwtPlot scale inconsistency.

    Hi Uwe,

    I have inserted in my plugins doubleclick event updateLayout() funtion instead of dialog.show() method. But there is no change on alignment problem. If I open any dialog or push the legend item which are clickable, alignment refresing but by calling updateLayout anything can't be changed.

    Regards.

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

    Default Re: QwtScale and QwtPlot scale inconsistency.

    Guess, there are some events hanging in the event queue, that are required to recalculate the correct layout. These events are processed by the recursive event loop of a modal dialog. Instead of opening a dialog I would expect a QApplication:rocessEvents() to have the same effect.

    Uwe

  5. #5
    Join Date
    Jan 2010
    Location
    Ankara - TURKEY
    Posts
    30
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtScale and QwtPlot scale inconsistency.

    Hi Uwe,

    My QwtPlot is plugin so I have no qApplication to queue my events. So I have used ui.gGraph->updateGeometry(); then problem resolved. I have another problem. I have 3 Graph vertically on my screen as you can see from LegendSizeProblem.jpg attachment. I want to make vertically aligned every single part (left scale, right scale, canvas and legend) of Graph.

    For canvas I able to set fixed size to be sama in all with setSize and setSizePolicy.

    For scales I able to set as below;

    Qt Code:
    1. QwtScaleDraw *sdLeft = axisScaleDraw(QwtPlot::yLeft);
    2. sdLeft->setMinimumExtent( 40 );
    3. QwtScaleDraw *sdRight = axisScaleDraw(QwtPlot::yRight);
    4. sdRight->setMinimumExtent( 40 );
    To copy to clipboard, switch view to plain text mode 

    For legend I already use that;
    I set my legend's font to QFont("Courier New", 10);, And I give my all curve a constant sized name so my every curve name in same font size. Then QwtPlotLayout can calculate same size for every Graph's legend so I can align every Graph's legend vertically. But how can I align every part of legend instead of setting font and curve name?

    For example I have tried that; I have set legend as below;

    Qt Code:
    1. legend->setMaximumWidth(100);
    2. legend->setMinimumWidth(100);
    3. legend->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    To copy to clipboard, switch view to plain text mode 

    Although my all legend size is same, QwtPlotLayout makes something wrong after this constant setting. How can I solve this problem as you can see from attached sreenshot.

    At this point I have another question, QwtPlotLayout only control's max curve name size which locate on legend? or which criteria is used by QwtPlotLayout to align every single part?

    Thanks so much.
    Regards.
    Attached Images Attached Images

  6. The following user says thank you to umituzun84 for this useful post:

    Astronomy (2nd July 2010)

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

    Default Re: QwtScale and QwtPlot scale inconsistency.

    T be honest I didn't completely understand what your question is about. But I guess the easiest way to implement your own layout is to insert the legend as QwtPlot::ExternalLegend and put legends and plots into a QGridLayout.

    Uwe

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

    umituzun84 (18th June 2010)

Similar Threads

  1. Replies: 0
    Last Post: 4th May 2010, 09:45
  2. Replies: 1
    Last Post: 21st April 2010, 02:54
  3. QwtPlotItem inverting qwtPlot scale
    By jmsbc in forum Qwt
    Replies: 1
    Last Post: 25th August 2009, 14:09
  4. QwtPlot: how to auto-scale two Y scales?
    By paradiza in forum Qwt
    Replies: 4
    Last Post: 24th March 2009, 01:28
  5. QwtScale Widget
    By Tavit in forum Qwt
    Replies: 1
    Last Post: 30th June 2008, 19:13

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.