24 #include <qapplication.h> 25 #include <qcoreevent.h> 34 QObject::connect( plot, sig, plot, slot );
36 QObject::disconnect( plot, sig, plot, slot );
40 QWidget *first, QWidget *second,
bool withChildren )
50 QWidget *w = second->nextInFocusChain();
51 while ( children.contains( w ) )
53 children.removeAll( w );
56 w = w->nextInFocusChain();
60 for (
int i = 0; i < tabChain.size() - 1; i++ )
62 QWidget *from = tabChain[i];
63 QWidget *to = tabChain[i+1];
65 const Qt::FocusPolicy policy1 = from->focusPolicy();
66 const Qt::FocusPolicy policy2 = to->focusPolicy();
68 QWidget *proxy1 = from->focusProxy();
69 QWidget *proxy2 = to->focusProxy();
71 from->setFocusPolicy( Qt::TabFocus );
72 from->setFocusProxy( NULL);
74 to->setFocusPolicy( Qt::TabFocus );
75 to->setFocusProxy( NULL);
77 QWidget::setTabOrder( from, to );
79 from->setFocusPolicy( policy1 );
80 from->setFocusProxy( proxy1);
82 to->setFocusPolicy( policy2 );
83 to->setFocusProxy( proxy2 );
145 d_data->
titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) );
170 setSizePolicy( QSizePolicy::MinimumExpanding,
171 QSizePolicy::MinimumExpanding );
180 for (
int i = 0; i < focusChain.size() - 1; i++ )
220 canvas->setParent(
this );
221 canvas->installEventFilter(
this );
236 bool ok = QFrame::event( event );
237 switch ( event->type() )
239 case QEvent::LayoutRequest:
242 case QEvent::PolishRequest:
272 if ( event->type() == QEvent::Resize )
276 else if ( event->type() == QEvent::ContentsRectChange )
282 return QFrame::eventFilter(
object, event );
481 for (
int axisId = 0; axisId <
axisCnt; axisId++ )
485 const int niceDist = 40;
492 int hDiff = ( majCnt - 1 ) * niceDist
499 int wDiff = ( majCnt - 1 ) * niceDist
515 hint += QSize( 2 * frameWidth(), 2 * frameWidth() );
526 QFrame::resizeEvent( e );
551 QApplication::sendPostedEvents(
this, QEvent::LayoutRequest );
555 const bool ok = QMetaObject::invokeMethod(
578 for (
int axisId = 0; axisId <
axisCnt; axisId++ )
605 for (
int axisId = 0; axisId <
axisCnt; axisId++ )
611 if ( scaleRect[axisId] != scaleWidget->geometry() )
613 scaleWidget->setGeometry( scaleRect[axisId] );
615 int startDist, endDist;
620 if ( !scaleWidget->isVisibleTo(
this ) )
661 const QwtScaleMap maps[],
const QRectF &canvasRect,
662 double &
left,
double &
top,
double &
right,
double &bottom)
const 664 left = top = right = bottom = -1.0;
668 it != itmList.end(); ++it )
697 for (
int axisId = 0; axisId <
axisCnt; axisId++ )
704 bool doUpdate =
false;
705 for (
int axisId = 0; axisId <
axisCnt; axisId++ )
707 if ( margins[axisId] >= 0.0 )
709 const int m =
qwtCeil( margins[axisId] );
731 for (
int axisId = 0; axisId <
axisCnt; axisId++ )
755 it != itmList.end(); ++it )
765 #if QT_VERSION < 0x050100 766 painter->setRenderHint( QPainter::HighQualityAntialiasing,
815 const QRect &canvasRect =
d_data->
canvas->contentsRect();
827 canvasRect.top() +
top );
840 canvasRect.right() -
right );
860 pal.setBrush( QPalette::Window, brush );
862 canvas()->setPalette( pal );
874 return canvas()->palette().brush(
875 QPalette::Normal, QPalette::Window );
969 QWidget *previousInChain = NULL;
979 previousInChain =
this;
994 if ( previousInChain )
1011 it != itmList.end(); ++it )
1025 if ( plotItem == NULL )
1033 const QVariant itemInfo =
itemToInfo( const_cast< QwtPlotItem *>( plotItem) );
1057 it != itmList.end(); ++it )
1080 it != itmList.end(); ++it )
1110 const QVariant itemInfo =
itemToInfo( plotItem );
1132 return QVariant::fromValue( plotItem );
1159 #include "moc_qwt_plot.cpp" virtual QList< QwtLegendData > legendData() const
Return all information, that is needed to represent the item on the legend.
void setTitle(const QString &)
const QwtScaleDiv & axisScaleDiv(int axisId) const
Return the scale division of a specified axis.
int canvasMargin(int axisId) const
virtual QwtPlotItem * infoToItem(const QVariant &) const
Identify the plot item according to an item info object, that has bee generated from itemToInfo()...
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
virtual void activate(const QwtPlot *, const QRectF &plotRect, Options options=Options())
Recalculate the geometry of all components.
void insertItem(QwtPlotItem *)
void setCanvasBackground(const QBrush &)
Change the background of the plotting area.
virtual void getCanvasMarginHint(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
Calculate a hint for the canvas margin.
A Widget which displays a QwtText.
QRectF legendRect() const
QwtTextLabel * titleLabel()
virtual void getCanvasMarginsHint(const QwtScaleMap maps[], const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
Calculate the canvas margins.
void setRenderFlags(int)
Change the render flags.
virtual void drawItems(QPainter *, const QRectF &, const QwtScaleMap maps[axisCnt]) const
QWT_CONSTEXPR float qwtMaxF(float a, float b)
int xAxis() const
Return xAxis.
QRectF footerRect() const
void setCanvas(QWidget *)
Set the drawing canvas of the plot widget.
virtual QVariant itemToInfo(QwtPlotItem *) const
Build an information, that can be used to identify a plot item on the legend.
QPointer< QWidget > canvas
const QwtPlotItemList & itemList() const
A QwtPlotItemList of all attached plot items.
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
QwtPlot::LegendPosition legendPosition() const
QPointer< QwtTextLabel > footerLabel
void autoRefresh()
Replots the plot if autoReplot() is true.
Y axis right of the canvas.
virtual void replot()
Redraw the plot.
A class representing a scale division.
void setCanvasMargin(int margin, int axis=-1)
QwtTextLabel * footerLabel()
void updateCanvasMargins()
Update the canvas margins.
virtual QSize minimumSizeHint(const QwtPlot *) const
bool axisEnabled(int axisId) const
void setScaleInterval(double s1, double s2)
Specify the borders of the scale interval.
static void qwtSetTabOrder(QWidget *first, QWidget *second, bool withChildren)
QPointer< QwtAbstractLegend > legend
Y axis left of the canvas.
QList< QwtPlotItem * >::ConstIterator QwtPlotItemIterator
static bool axisValid(int axisId)
double upperBound() const
void legendDataChanged(const QVariant &itemInfo, const QList< QwtLegendData > &data)
const QwtScaleWidget * axisWidget(int axisId) const
QwtAbstractLegend * legend()
The item is represented on the legend.
QBrush canvasBackground() const
The legend will be below the footer.
bool testItemAttribute(ItemAttribute) const
void setPlotLayout(QwtPlotLayout *)
Assign a new plot layout.
QRectF scaleRect(int axis) const
QwtPlot(QWidget *=NULL)
Constructor.
virtual void updateLayout()
Adjust plot content to its current size.
bool testRenderHint(RenderHint) const
void detachItems(int rtti=QwtPlotItem::Rtti_PlotItem, bool autoDelete=true)
void setLegendPosition(QwtPlot::LegendPosition pos, double ratio)
Specify the position of the legend.
virtual void drawCanvas(QPainter *)
const QwtScaleDiv & scaleDiv() const
double lowerBound() const
void setTransformation(QwtTransform *)
void initAxesData()
Initialize axes.
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
virtual ~QwtPlot()
Destructor.
A class representing a text.
virtual QwtScaleMap canvasMap(int axisId) const
virtual bool eventFilter(QObject *, QEvent *) QWT_OVERRIDE
Event filter.
void attachItem(QwtPlotItem *, bool)
Attach/Detach a plot item.
The legend will be right from the QwtPlot::yRight axis.
void setFooter(const QString &)
int yAxis() const
Return yAxis.
The legend will be left from the QwtPlot::yLeft axis.
QRectF canvasRect() const
QPointer< QwtTextLabel > titleLabel
static void qwtEnableLegendItems(QwtPlot *plot, bool on)
virtual QSize sizeHint() const QWT_OVERRIDE
virtual QSize minimumSizeHint() const QWT_OVERRIDE
Return a minimum size hint.
bool testItemInterest(ItemInterest) const
Abstract base class for legend widgets.
bool alignCanvasToScale(int axisId) const
Layout engine for QwtPlot.
virtual bool event(QEvent *) QWT_OVERRIDE
Adds handling of layout requests.
virtual void resizeEvent(QResizeEvent *) QWT_OVERRIDE
void initPlot(const QwtText &title)
Initializes a QwtPlot instance.
void insertLegend(QwtAbstractLegend *, LegendPosition=QwtPlot::RightLegend, double ratio=-1.0)
Insert a legend.
QwtScaleEngine * axisScaleEngine(int axisId)
void setRenderHint(RenderHint, bool on=true)
void setMaxColumns(uint numColums)
Set the maximum number of entries in a row.
virtual void updateLegend(const QwtPlotItem *, const QList< QwtLegendData > &)
Update the item to changes of the legend info.
The legend will be above the title.
Base class for items on the plot canvas.
QList< double > ticks(int tickType) const
void updateAxes()
Rebuild the axes scales.
void updateLegendItems(const QVariant &itemInfo, const QList< QwtLegendData > &legendData)
Update all plot items interested in legend attributes.
void removeItem(QwtPlotItem *)
void itemAttached(QwtPlotItem *plotItem, bool on)
Unspecific value, that can be used, when it doesn't matter.
QwtPlotLayout * plotLayout()