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.
Re: QwtScale and QwtPlot scale inconsistency.
The layout of the plot widgets is recalculated in QwtPlot::updateLayout.
Uwe
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.
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::processEvents() to have the same effect.
Uwe
1 Attachment(s)
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;
Code:
sdLeft->setMinimumExtent( 40 );
sdRight->setMinimumExtent( 40 );
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;
Code:
legend->setMaximumWidth(100);
legend->setMinimumWidth(100);
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.
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