当前位置: 首页>>代码示例>>C++>>正文


C++ QwtPlotCanvas::installEventFilter方法代码示例

本文整理汇总了C++中QwtPlotCanvas::installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCanvas::installEventFilter方法的具体用法?C++ QwtPlotCanvas::installEventFilter怎么用?C++ QwtPlotCanvas::installEventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QwtPlotCanvas的用法示例。


在下文中一共展示了QwtPlotCanvas::installEventFilter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QObject

    CanvasPicker::CanvasPicker(Plot *plot):
        QObject(plot),
        d_selectedCurve(NULL),
        d_selectedPoint(-1)
    {
        qDebug() << __FILE__ << __FUNCTION__;

        QwtPlotCanvas *canvas = (QwtPlotCanvas*) plot->canvas();

        canvas->installEventFilter(this);

        // We want the focus, but no focus rect. The
        // selected point will be highlighted instead.

        canvas->setFocusPolicy(Qt::StrongFocus);
    #ifndef QT_NO_CURSOR
        canvas->setCursor(Qt::PointingHandCursor);
    #endif
        canvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
        canvas->setFocus();

        mousePressed = false;

        accelerate = 0;

    }
开发者ID:peder2key,项目名称:gpsbook,代码行数:26,代码来源:canvaspicker.cpp

示例2: QObject

CanvasPicker::CanvasPicker( QwtPlot *plot ):
    QObject( plot ),
    d_selectedCurve( NULL ),
    d_selectedPoint( -1 )
{
    QwtPlotCanvas *canvas = qobject_cast<QwtPlotCanvas *>( plot->canvas() );
    canvas->installEventFilter( this );

    // We want the focus, but no focus rect. The
    // selected point will be highlighted instead.

    canvas->setFocusPolicy( Qt::StrongFocus );
#ifndef QT_NO_CURSOR
    canvas->setCursor( Qt::PointingHandCursor );
#endif
    canvas->setFocusIndicator( QwtPlotCanvas::ItemFocusIndicator );
    canvas->setFocus();

    const char *text =
        "All points can be moved using the left mouse button "
        "or with these keys:\n\n"
        "- Up:\t\tSelect next curve\n"
        "- Down:\t\tSelect previous curve\n"
        "- Left, ´-´:\tSelect next point\n"
        "- Right, ´+´:\tSelect previous point\n"
        "- 7, 8, 9, 4, 6, 1, 2, 3:\tMove selected point";
    canvas->setWhatsThis( text );

    shiftCurveCursor( true );
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:30,代码来源:canvaspicker.cpp

示例3:

CanvasPicker::CanvasPicker(Graph *graph):
	QObject(graph)
{
	pointSelected = false;
	d_editing_marker = 0;

	QwtPlotCanvas *canvas = graph->canvas();
	canvas->installEventFilter(this);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:9,代码来源:CanvasPicker.cpp

示例4: QObject

CanvasPicker::CanvasPicker( QwtPlot* plot ): QObject( plot ), m_isEnabled( false ), m_dragAndDropInProgress( false ),
	m_typeOfItemsToDrag( -1 ), m_itemToPick( 0 )
{
    QwtPlotCanvas* canvas = qobject_cast<QwtPlotCanvas*>( plot->canvas() );
    canvas->installEventFilter( this );
	m_isEnabled = true;

    canvas->setFocusPolicy( Qt::StrongFocus );
    canvas->setFocusIndicator( QwtPlotCanvas::ItemFocusIndicator );
    canvas->setFocus();
}
开发者ID:Wushaowei001,项目名称:OptimaPlotter,代码行数:11,代码来源:canvaspicker.cpp

示例5: setEnabled

void CanvasPicker::setEnabled( bool enabled )
{
	if( m_isEnabled != enabled )
	{
		QwtPlotCanvas* canvas = qobject_cast<QwtPlotCanvas*>( plot()->canvas() );
		m_isEnabled = enabled;
		if( enabled )
			canvas->installEventFilter( this );
		else
			canvas->removeEventFilter( this );
	}
}
开发者ID:Wushaowei001,项目名称:OptimaPlotter,代码行数:12,代码来源:canvaspicker.cpp

示例6: QwtPlotPicker

LineChartPicker::LineChartPicker(QwtPlot *plot) :
    QwtPlotPicker(plot->canvas()),
    p(plot)
{
  QwtPlotCanvas *canvas = plot->canvas();

  canvas->installEventFilter(this);

  canvas->setFocusPolicy(Qt::StrongFocus);
  canvas->setMouseTracking(true);
  canvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
  canvas->setFocus();
}
开发者ID:SidneyTTW,项目名称:PCHMS-Remake,代码行数:13,代码来源:linechartpicker.cpp

示例7: QDialog

DialogFunction::DialogFunction( const LinearFunction::Description::Ptr& pDescription,
								const QPolygonF& curveSamples,
								QWidget* pParent)
	: QDialog(pParent)
	, _pDescription(pDescription)
	, _indexSelectedPoint(-1)
	, _relativeIndex(0)
{
	setupUi(this);

	widgetPlot->setMinimumSize(1,1);
	widgetPlot->setAxisScale(QwtPlot::xBottom, _pDescription->xMin, _pDescription->xMax);
	widgetPlot->setAxisScale(QwtPlot::yLeft, _pDescription->yMin, _pDescription->yMax);
	widgetPlot->setAxisMaxMinor(QwtPlot::yLeft, 2);
	widgetPlot->setAxisMaxMinor(QwtPlot::xBottom, 2);
	widgetPlot->setCanvasBackground(QColor(Qt::black));
	widgetPlot->setAxisTitle(QwtPlot::xBottom, _pDescription->szLabelX);
	widgetPlot->setAxisTitle(QwtPlot::yLeft, _pDescription->szLabelY);

	_pCurve.reset(new QwtPlotCurve());
	_pCurve->setStyle(QwtPlotCurve::Lines);
	_pCurve->setPen(Qt::white);
	_pCurve->setSymbol(new QwtSymbol(QwtSymbol::Diamond, Qt::lightGray, _pCurve->pen(), QSize(8,8)));
	QwtArraySeriesData<QPointF>* pSeries = static_cast<QwtArraySeriesData<QPointF>*>(_pCurve->data());
	if (pSeries)
	{
		_pCurve->setSamples(curveSamples);
	}
	_pCurve->attach(widgetPlot);

	QwtPlotGrid* pGrid = new QwtPlotGrid;
	pGrid->setMajorPen(QPen(Qt::gray, 0, Qt::DotLine));
	pGrid->attach(widgetPlot);

	QwtPlotCanvas* pPlotCanvas = static_cast<QwtPlotCanvas*>(widgetPlot->canvas());
	pPlotCanvas->installEventFilter(this);
	pPlotCanvas->setMouseTracking(true);
}
开发者ID:FromtonRouge,项目名称:eProDrums,代码行数:38,代码来源:DialogFunction.cpp

示例8: plot

/*!
  \brief Draw a set of points of a curve.

  When observing an measurement while it is running, new points have to be
  added to an existing curve. drawCurve can be used to display them avoiding
  a complete redraw of the canvas.

  Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
  will result in faster painting, if the paint engine of the canvas widget
  supports this feature. 

  \param from Index of the first point to be painted
  \param to Index of the last point to be painted. If to < 0 the
         curve will be painted to its last point.

  \sa drawCurve(), drawSymbols()
*/
void QwtPlotCurve::draw(int from, int to) const
{
    if ( !plot() )
        return;

    QwtPlotCanvas *canvas = plot()->canvas();

#if QT_VERSION >= 0x040000
#if 0
    if ( canvas->paintEngine()->type() == QPaintEngine::OpenGL )
    {
        /*
            OpenGL alway repaint the complete widget.
            So for this operation OpenGL is one of the slowest
            environments.
         */
        canvas->repaint();
        return;
    }
#endif

    if ( !canvas->testAttribute(Qt::WA_WState_InPaintEvent) &&
        !canvas->testAttribute(Qt::WA_PaintOutsidePaintEvent) )
    {
        /*
          We save curve and range in helper and call repaint.
          The helper filters the Paint event, to repeat
          the QwtPlotCurve::draw, but now from inside the paint
          event.
         */

        QwtPlotCurvePaintHelper helper(this, from, to);
        canvas->installEventFilter(&helper);

        const bool noSystemBackground =
            canvas->testAttribute(Qt::WA_NoSystemBackground);
        canvas->setAttribute(Qt::WA_NoSystemBackground, true);
        canvas->repaint();
        canvas->setAttribute(Qt::WA_NoSystemBackground, noSystemBackground);

        return;
    }
#endif

    const QwtScaleMap xMap = plot()->canvasMap(xAxis());
    const QwtScaleMap yMap = plot()->canvasMap(yAxis());

    if ( canvas->testPaintAttribute(QwtPlotCanvas::PaintCached) &&
        canvas->paintCache() && !canvas->paintCache()->isNull() )
    {
        QPainter cachePainter((QPixmap *)canvas->paintCache());
        cachePainter.translate(-canvas->contentsRect().x(),
            -canvas->contentsRect().y());

        draw(&cachePainter, xMap, yMap, from, to);
    }

#if QT_VERSION >= 0x040000
    if ( canvas->testAttribute(Qt::WA_WState_InPaintEvent) )
    {
        QPainter painter(canvas);

        painter.setClipping(true);
        painter.setClipRect(canvas->contentsRect());

        draw(&painter, xMap, yMap, from, to);
    }
    else
#endif
    {
        QPainter *painter = d_data->guardedPainter.begin(canvas);
        draw(painter, xMap, yMap, from, to);
    }
}
开发者ID:AlexKraemer,项目名称:RFID_ME_HW_GUI,代码行数:91,代码来源:qwt_plot_curve.cpp

示例9: plot

/*!
  \brief Draw a set of points of a seriesItem.

  When observing an measurement while it is running, new points have to be
  added to an existing seriesItem. drawSeries can be used to display them avoiding
  a complete redraw of the canvas.

  Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
  will result in faster painting, if the paint engine of the canvas widget
  supports this feature.

  \param seriesItem Item to be painted
  \param from Index of the first point to be painted
  \param to Index of the last point to be painted. If to < 0 the
         series will be painted to its last point.
*/
void QwtPlotDirectPainter::drawSeries(
    QwtPlotAbstractSeriesItem *seriesItem, int from, int to )
{
    if ( seriesItem == NULL || seriesItem->plot() == NULL )
        return;

    QwtPlotCanvas *canvas = seriesItem->plot()->canvas();
    const QRect canvasRect = canvas->contentsRect();

    const bool hasBackingStore = 
        canvas->testPaintAttribute( QwtPlotCanvas::BackingStore ) 
        && canvas->backingStore() && !canvas->backingStore()->isNull();

    if ( hasBackingStore )
    {
        QPainter painter( const_cast<QPixmap *>( canvas->backingStore() ) );

        if ( d_data->hasClipping )
            painter.setClipRegion( d_data->clipRegion );

        renderItem( &painter, canvasRect, seriesItem, from, to );

        if ( testAttribute( QwtPlotDirectPainter::FullRepaint ) )
        {
            canvas->repaint();
            return;
        }
    }

    bool immediatePaint = true;
    if ( !canvas->testAttribute( Qt::WA_WState_InPaintEvent ) )
    {
        immediatePaint = false;
    }

    if ( immediatePaint )
    {
        if ( !d_data->painter.isActive() )
        {
            reset();

            d_data->painter.begin( canvas );
            canvas->installEventFilter( this );
        }

        if ( d_data->hasClipping )
        {
            d_data->painter.setClipRegion( 
                QRegion( canvasRect ) & d_data->clipRegion );
        }
        else
        {
            if ( !d_data->painter.hasClipping() )
                d_data->painter.setClipRect( canvasRect );
        }

        renderItem( &d_data->painter, canvasRect, seriesItem, from, to );

        if ( d_data->attributes & QwtPlotDirectPainter::AtomicPainter )
        {
            reset();
        }
        else
        {
            if ( d_data->hasClipping )
                d_data->painter.setClipping( false );
        }
    }
    else
    {
        reset();

        d_data->seriesItem = seriesItem;
        d_data->from = from;
        d_data->to = to;

        QRegion clipRegion = canvasRect;
        if ( d_data->hasClipping )
            clipRegion &= d_data->clipRegion;

        canvas->installEventFilter( this );
        canvas->repaint(clipRegion);
        canvas->removeEventFilter( this );

//.........这里部分代码省略.........
开发者ID:EQ4,项目名称:Visore,代码行数:101,代码来源:qwt_plot_directpainter.cpp

示例10: plot

/*!
  \brief Draw a set of points of a seriesItem.

  When observing an measurement while it is running, new points have to be
  added to an existing seriesItem. drawSeries can be used to display them avoiding
  a complete redraw of the canvas.

  Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
  will result in faster painting, if the paint engine of the canvas widget
  supports this feature.

  \param seriesItem Item to be painted
  \param from Index of the first point to be painted
  \param to Index of the last point to be painted. If to < 0 the
         series will be painted to its last point.
*/
void QwtPlotDirectPainter::drawSeries(
    QwtPlotAbstractSeriesItem *seriesItem, int from, int to )
{
    if ( seriesItem == NULL || seriesItem->plot() == NULL )
        return;

    QwtPlotCanvas *canvas = seriesItem->plot()->canvas();

    if ( canvas->testPaintAttribute( QwtPlotCanvas::PaintCached ) &&
        canvas->paintCache() && !canvas->paintCache()->isNull() )
    {
        QPainter painter( ( QPixmap * )canvas->paintCache() );
        painter.translate( -canvas->contentsRect().x(),
            -canvas->contentsRect().y() );

        renderItem( &painter, seriesItem, from, to );

        if ( d_data->attributes & FullRepaint )
        {
            canvas->repaint();
            return;
        }
    }

    bool immediatePaint = true;
    if ( !canvas->testAttribute( Qt::WA_WState_InPaintEvent ) &&
        !canvas->testAttribute( Qt::WA_PaintOutsidePaintEvent ) )
    {
        immediatePaint = false;
    }

    if ( immediatePaint )
    {
        QwtPlotCanvas *canvas = seriesItem->plot()->canvas();
        if ( !( d_data->painter.isActive() &&
            d_data->painter.device() == canvas ) )
        {
            reset();

            d_data->painter.begin( canvas );
            d_data->painter.setClipping( true );
            d_data->painter.setClipRect( canvas->contentsRect() );

            canvas->installEventFilter( this );
        }

        renderItem( &d_data->painter, seriesItem, from, to );

        if ( d_data->attributes & AtomicPainter )
            reset();
    }
    else
    {
        reset();

        d_data->seriesItem = seriesItem;
        d_data->from = from;
        d_data->to = to;

        canvas->installEventFilter( this );
        canvas->repaint();
        canvas->removeEventFilter( this );

        d_data->seriesItem = NULL;
    }
}
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:82,代码来源:qwt_plot_directpainter.cpp


注:本文中的QwtPlotCanvas::installEventFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。