Dhanya Thattil 38cd10d4e6
Qt5 built in qwt (#570)
- qt4->qt5
- in built qt5 6.1.5 because rhel7 is not upto date with qt5, removed findqwt.cmake
- made a fix in qwt lib (qwt_plot_layout.h) to work with 5.15 and lower versions for qrect constr.
- qt5 forms fixed, qt4 many hard coding forms switched to forms including qtabwidget, scrolls etc, fonts moved to forms
 - docking option enabled by default, removed option to disable docking feature from "Mode"
- added qVersionResolve utility functions to handle compatibility before and after qt5.12
- qtplots (ian's code) takes in gain mode enable to set some settings within the class, with proper gain plot ticks
- ensure gain plots have no zooming of z axis in 2d and y axis in 1d
- removed placeholder text in qpalette in main window form as its not supportd until 5.12 (so using qt5.9 designer insted of qt5.15 to cope)
- tab order
Servers:
- fixed some error messages that were empty for fail in funcs (mostly minor as if this error, major issues)
2022-11-11 15:15:10 +01:00

171 lines
4.4 KiB
C++

/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PLOT_RENDERER_H
#define QWT_PLOT_RENDERER_H
#include "qwt_global.h"
#include <qobject.h>
#include <qsize.h>
class QwtPlot;
class QwtScaleMap;
class QRectF;
class QPainter;
class QPaintDevice;
#ifndef QT_NO_PRINTER
class QPrinter;
#endif
#ifndef QWT_NO_SVG
#ifdef QT_SVG_LIB
class QSvgGenerator;
#endif
#endif
/*!
\brief Renderer for exporting a plot to a document, a printer
or anything else, that is supported by QPainter/QPaintDevice
*/
class QWT_EXPORT QwtPlotRenderer: public QObject
{
Q_OBJECT
public:
//! Disard flags
enum DiscardFlag
{
//! Render all components of the plot
DiscardNone = 0x00,
//! Don't render the background of the plot
DiscardBackground = 0x01,
//! Don't render the title of the plot
DiscardTitle = 0x02,
//! Don't render the legend of the plot
DiscardLegend = 0x04,
//! Don't render the background of the canvas
DiscardCanvasBackground = 0x08,
//! Don't render the footer of the plot
DiscardFooter = 0x10,
/*!
Don't render the frame of the canvas
\note This flag has no effect when using
style sheets, where the frame is part
of the background
*/
DiscardCanvasFrame = 0x20
};
//! Disard flags
typedef QFlags<DiscardFlag> DiscardFlags;
/*!
\brief Layout flags
\sa setLayoutFlag(), testLayoutFlag()
*/
enum LayoutFlag
{
//! Use the default layout as on screen
DefaultLayout = 0x00,
/*!
Instead of the scales a box is painted around the plot canvas,
where the scale ticks are aligned to.
*/
FrameWithScales = 0x01
};
//! Layout flags
typedef QFlags<LayoutFlag> LayoutFlags;
explicit QwtPlotRenderer( QObject * = NULL );
virtual ~QwtPlotRenderer();
void setDiscardFlag( DiscardFlag flag, bool on = true );
bool testDiscardFlag( DiscardFlag flag ) const;
void setDiscardFlags( DiscardFlags flags );
DiscardFlags discardFlags() const;
void setLayoutFlag( LayoutFlag flag, bool on = true );
bool testLayoutFlag( LayoutFlag flag ) const;
void setLayoutFlags( LayoutFlags flags );
LayoutFlags layoutFlags() const;
void renderDocument( QwtPlot *, const QString &fileName,
const QSizeF &sizeMM, int resolution = 85 );
void renderDocument( QwtPlot *,
const QString &fileName, const QString &format,
const QSizeF &sizeMM, int resolution = 85 );
#ifndef QWT_NO_SVG
#ifdef QT_SVG_LIB
#if QT_VERSION >= 0x040500
void renderTo( QwtPlot *, QSvgGenerator & ) const;
#endif
#endif
#endif
#ifndef QT_NO_PRINTER
void renderTo( QwtPlot *, QPrinter & ) const;
#endif
void renderTo( QwtPlot *, QPaintDevice & ) const;
virtual void render( QwtPlot *,
QPainter *, const QRectF &plotRect ) const;
virtual void renderTitle( const QwtPlot *,
QPainter *, const QRectF &titleRect ) const;
virtual void renderFooter( const QwtPlot *,
QPainter *, const QRectF &footerRect ) const;
virtual void renderScale( const QwtPlot *, QPainter *,
int axisId, int startDist, int endDist,
int baseDist, const QRectF &scaleRect ) const;
virtual void renderCanvas( const QwtPlot *,
QPainter *, const QRectF &canvasRect,
const QwtScaleMap* maps ) const;
virtual void renderLegend(
const QwtPlot *, QPainter *, const QRectF &legendRect ) const;
bool exportTo( QwtPlot *, const QString &documentName,
const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
private:
void buildCanvasMaps( const QwtPlot *,
const QRectF &, QwtScaleMap maps[] ) const;
bool updateCanvasMargins( QwtPlot *,
const QRectF &, const QwtScaleMap maps[] ) const;
private:
class PrivateData;
PrivateData *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
#endif