PDA

View Full Version : Size of Non visible Plot when capturing to pixmap



KMAPSRULE
7th January 2010, 22:03
I'm not sure this is truly a QWT issue but I'm seeing the issue While using QWT so:

I have a QT GUI that Controls a test suite program that runs against a system and
plots the response from the system to verify that the system is within tolerance.

Each test consists of up to 12 plots, the GUI organizes these plots onto tabs of a QTabWidget,
and lays the plots out in QGridLayout on each tab.

When the Test completes, a signal is emitted telling each plot to save itself to an image file.
then these images are printed to a PDF Document that reports the test results.
The Size of the plots are not fixed as the scales and how many plots live on each tab are read in from a config
file.

The issue I am seeing is that , if a plot is not visible (e.g. it is not on the currently selected tab) when the
print to pixmap occurs, the Size of the plot is 640x480.

If the Plot is on the currently selected tab and visible then the correct size of the plot is captured.

So My question is:

Is there a way to stop the plots from shrinking when hidden?
(setting the layout stretch factor to 0?)


here is the code from my capture function:


//-----------------------------------------------------
QPixmap resultPlot::hardcopyToPixmap()
{
QPixmap pixmap ( this->size() );

pixmap.fill ( Qt::white );

QwtPlotPrintFilter filter;
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales;
filter.setOptions ( options );

this->print ( pixmap, filter );

return ( pixmap );

}


Thanks in advance