Go to the documentation of this file.
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 );
93 QPointer< QwtAbstractLegend >
legend;
145 m_data->
titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) );
148 text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap );
170 setSizePolicy( QSizePolicy::MinimumExpanding,
171 QSizePolicy::MinimumExpanding );
183 for (
int i = 0; i < focusChain.size() - 1; i++ )
223 canvas->setParent(
this );
224 canvas->installEventFilter(
this );
239 bool ok = QFrame::event(
event );
240 switch (
event->type() )
242 case QEvent::LayoutRequest:
245 case QEvent::PolishRequest:
275 if (
event->type() == QEvent::Resize )
279 else if (
event->type() == QEvent::ContentsRectChange )
285 return QFrame::eventFilter(
object,
event );
492 const int niceDist = 40;
501 const int hDiff = ( majCnt - 1 ) * niceDist - hint.height();
502 dh = qMax( dh, hDiff );
506 const int wDiff = ( majCnt - 1 ) * niceDist - hint.width();
507 dw = qMax( dw, wDiff );
521 hint += QSize( 2 * frameWidth(), 2 * frameWidth() );
532 QFrame::resizeEvent( e );
557 QApplication::sendPostedEvents(
this, QEvent::LayoutRequest );
561 const bool ok = QMetaObject::invokeMethod(
580 layout->
activate(
this, contentsRect() );
582 const QRect titleRect = layout->
titleRect().toRect();
583 const QRect footerRect = layout->
footerRect().toRect();
584 const QRect legendRect = layout->
legendRect().toRect();
585 const QRect canvasRect = layout->
canvasRect().toRect();
618 const QRect scaleRect = layout->
scaleRect( axisId ).toRect();
620 if ( scaleRect != scaleWidget->geometry() )
622 scaleWidget->setGeometry( scaleRect );
624 int startDist, endDist;
629 if ( !scaleWidget->isVisibleTo(
this ) )
671 const QwtScaleMap maps[],
const QRectF& canvasRect,
672 double&
left,
double&
top,
double&
right,
double& bottom)
const
678 it != itmList.end(); ++it )
718 bool doUpdate =
false;
721 if ( margins[axisPos] >= 0.0 )
723 const int m =
qwtCeil( margins[axisPos] );
769 it != itmList.end(); ++it )
779 painter->setRenderHint( QPainter::Antialiasing,
782 #if QT_VERSION < 0x050100
783 painter->setRenderHint( QPainter::HighQualityAntialiasing,
787 item->
draw( painter, maps[xAxis], maps[yAxis], canvasRect );
817 double h =
s->height() -
s->startBorderDist() -
s->endBorderDist();
818 map.setPaintInterval(
y + h,
y );
823 double w =
s->width() -
s->startBorderDist() -
s->endBorderDist();
824 map.setPaintInterval(
x,
x + w );
831 const QRect& canvasRect =
m_data->
canvas->contentsRect();
842 map.setPaintInterval( canvasRect.bottom() - bottom,
843 canvasRect.top() +
top );
855 map.setPaintInterval( canvasRect.left() +
left,
856 canvasRect.right() -
right );
876 pal.setBrush( QPalette::Window, brush );
878 canvas()->setPalette( pal );
890 return canvas()->palette().brush(
891 QPalette::Normal, QPalette::Window );
976 QWidget* previousInChain = NULL;
987 previousInChain =
this;
1003 if ( previousInChain )
1020 it != itmList.end(); ++it )
1034 if ( plotItem == NULL )
1066 it != itmList.end(); ++it )
1089 it != itmList.end(); ++it )
1119 const QVariant itemInfo =
itemToInfo( plotItem );
1141 return QVariant::fromValue( plotItem );
1162 return qvariant_cast< QwtPlotItem* >( itemInfo );
1168 #include "moc_qwt_plot.cpp"
QwtTextLabel * footerLabel()
const QwtPlotItemList & itemList() const
A QwtPlotItemList of all attached plot items.
void removeItem(QwtPlotItem *)
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.
QwtAbstractLegend * legend()
auto first(const T &value, const Tail &...) -> const T &
void setTitle(const QString &)
virtual void getCanvasMarginsHint(const QwtScaleMap maps[], const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
Calculate the canvas margins.
bool isYAxis(int axisPos)
void itemAttached(QwtPlotItem *plotItem, bool on)
virtual bool event(QEvent *) QWT_OVERRIDE
Adds handling of layout requests.
void insertLegend(QwtAbstractLegend *, LegendPosition=QwtPlot::RightLegend, double ratio=-1.0)
Insert a legend.
QRectF footerRect() const
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
QRectF canvasRect() const
virtual QVariant itemToInfo(QwtPlotItem *) const
Build an information, that can be used to identify a plot item on the legend.
virtual QSize minimumSizeHint() const QWT_OVERRIDE
Return a minimum size hint.
Abstract base class for legend widgets.
@ TopLegend
The legend will be above the title.
static void qwtSetTabOrder(QWidget *first, QWidget *second, bool withChildren)
void updateLegendItems(const QVariant &itemInfo, const QList< QwtLegendData > &legendData)
Update all plot items interested in legend attributes.
QPointer< QwtTextLabel > titleLabel
const QwtScaleDiv & scaleDiv() const
void insertItem(QwtPlotItem *)
void setPlotLayout(QwtPlotLayout *)
Assign a new plot layout.
QPointer< QwtAbstractLegend > legend
double lowerBound() const
void setRenderFlags(int)
Change the render flags.
@ Legend
The item is represented on the legend.
QRectF legendRect() const
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
@ YLeft
Y axis left of the canvas.
void legendDataChanged(const QVariant &itemInfo, const QList< QwtLegendData > &data)
QwtAxisId xAxis() const
Return xAxis.
virtual void resizeEvent(QResizeEvent *) QWT_OVERRIDE
void setLegendPosition(QwtPlot::LegendPosition pos, double ratio)
Specify the position of the legend.
const QwtScaleWidget * axisWidget(QwtAxisId) const
virtual void drawItems(QPainter *, const QRectF &, const QwtScaleMap maps[QwtAxis::AxisPositions]) const
virtual ~QwtPlot()
Destructor.
void initPlot(const QwtText &title)
Initializes a QwtPlot instance.
void autoRefresh()
Replots the plot if autoReplot() is true.
QList< double > ticks(int tickType) const
void setCanvasBackground(const QBrush &)
Change the background of the plotting area.
A class representing a text.
A Widget which displays a QwtText.
QPointer< QwtTextLabel > footerLabel
QWT_CONSTEXPR float qwtMaxF(float a, float b)
@ Rtti_PlotItem
Unspecific value, that can be used, when it doesn't matter.
void setCanvasMargin(int margin, int axis=-1)
virtual void activate(const QwtPlot *, const QRectF &plotRect, Options options=Options())
Recalculate the geometry of all components.
double upperBound() const
QwtPlot::LegendPosition legendPosition() const
void setMaxColumns(uint numColums)
Set the maximum number of entries in a row.
virtual bool eventFilter(QObject *, QEvent *) QWT_OVERRIDE
Event filter.
int canvasMargin(int axisId) const
Base class for items on the plot canvas.
virtual QList< QwtLegendData > legendData() const
Return all information, that is needed to represent the item on the legend.
@ LeftLegend
The legend will be left from the QwtAxis::YLeft axis.
const QwtScaleDiv & axisScaleDiv(QwtAxisId) const
Return the scale division of a specified axis.
static void qwtEnableLegendItems(QwtPlot *plot, bool on)
int QwtAxisId
Axis identifier.
QList< QwtPlotItem * >::ConstIterator QwtPlotItemIterator
void attachItem(QwtPlotItem *, bool)
Attach/Detach a plot item.
QRectF scaleRect(QwtAxisId) const
Layout engine for QwtPlot.
void detachItems(int rtti=QwtPlotItem::Rtti_PlotItem, bool autoDelete=true)
bool testItemInterest(ItemInterest) const
QwtPlot(QWidget *=NULL)
Constructor.
virtual QwtPlotItem * infoToItem(const QVariant &) const
Identify the plot item according to an item info object, that has bee generated from itemToInfo().
virtual QSize minimumSizeHint(const QwtPlot *) const
QwtTextLabel * titleLabel()
virtual void replot()
Redraw the plot.
virtual void drawCanvas(QPainter *)
virtual void updateLegend(const QwtPlotItem *, const QList< QwtLegendData > &)
Update the item to changes of the legend info.
@ RightLegend
The legend will be right from the QwtAxis::YRight axis.
QPointer< QWidget > canvas
virtual QSize sizeHint() const QWT_OVERRIDE
@ XTop
X axis above the canvas.
A class representing a scale division.
void setFooter(const QString &)
bool testRenderHint(RenderHint) const
virtual QwtScaleMap canvasMap(QwtAxisId) const
@ RenderAntialiased
Enable antialiasing.
bool isAxisVisible(QwtAxisId) const
bool testItemAttribute(ItemAttribute) const
QwtAxisId yAxis() const
Return yAxis.
void updateCanvasMargins()
Update the canvas margins.
@ BottomLegend
The legend will be below the footer.
@ YRight
Y axis right of the canvas.
QwtScaleEngine * axisScaleEngine(QwtAxisId)
virtual void updateLayout()
Adjust plot content to its current size.
QwtPlotLayout * plotLayout()
void updateAxes()
Rebuild the axes scales.
void setCanvas(QWidget *)
Set the drawing canvas of the plot widget.
@ XBottom
X axis below the canvas.
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45