Example #1
1
QTabWidget* ResultsPage::createDataTabWidget()
{
    QTabWidget *tabWidget = new QTabWidget;

    // Plot
    m_plot = new QwtPlot(tabWidget);
    m_plot->setCanvasBackground(Qt::white);
    m_plot->setContextMenuPolicy(Qt::CustomContextMenu);
    m_plot->setAutoReplot(false);

    connect(m_plot, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showPlotContextMenu(QPoint)));
    
    // Picker to allow for selection of the closest curve and displays curve
    // coordinates with a cross rubber band.
    QwtPlotPicker *picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                                              QwtPicker::CrossRubberBand, QwtPicker::ActiveOnly,
                                              m_plot->canvas());
    picker->setStateMachine(new QwtPickerDragPointMachine());

    connect(picker, SIGNAL(appended(QPoint)), this, SLOT(pointSelected(QPoint)));

    // Legend
    QwtLegend* legend = new QwtLegend;
    legend->setFrameStyle(QFrame::Box | QFrame::Sunken);
    m_plot->insertLegend(legend, QwtPlot::BottomLegend);
#if QWT_VERSION >= 0x060100
    connect(m_plot,
            SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)),
            legend,
            SLOT(updateLegend(QVariant,QList<QwtLegendData>)));
#endif

    // Add the generic curves to the legend
    QList<QPair<QString, Qt::GlobalColor> > pairs;
    pairs << qMakePair(tr("Unselected Realization"), Qt::darkGray)
          << qMakePair(tr("Selected and Enabled Realization"), Qt::darkGreen)
          << qMakePair(tr("Selected and Disabled Realization"), Qt::darkRed);

    QPair<QString, Qt::GlobalColor> pair;
    foreach (pair, pairs) {
        QwtPlotCurve *curve = new QwtPlotCurve(pair.first);

        curve->setLegendIconSize(QSize(32, 8));
        curve->setPen(QPen(QBrush(pair.second), 2));
        curve->setLegendAttribute(QwtPlotCurve::LegendShowLine);
#if QWT_VERSION < 0x060100
        curve->updateLegend(legend);
#else
        m_plot->updateLegend(curve);
#endif
    }
Example #2
0
int QwtPicker::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: activated((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: selected((*reinterpret_cast< const QPolygon(*)>(_a[1]))); break;
        case 2: appended((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 3: moved((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 4: removed((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 5: changed((*reinterpret_cast< const QPolygon(*)>(_a[1]))); break;
        case 6: setEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 7;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isEnabled(); break;
        case 1: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break;
        case 2: *reinterpret_cast< DisplayMode*>(_v) = trackerMode(); break;
        case 3: *reinterpret_cast< QPen*>(_v) = trackerPen(); break;
        case 4: *reinterpret_cast< QFont*>(_v) = trackerFont(); break;
        case 5: *reinterpret_cast< RubberBand*>(_v) = rubberBand(); break;
        case 6: *reinterpret_cast< QPen*>(_v) = rubberBandPen(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break;
        case 2: setTrackerMode(*reinterpret_cast< DisplayMode*>(_v)); break;
        case 3: setTrackerPen(*reinterpret_cast< QPen*>(_v)); break;
        case 4: setTrackerFont(*reinterpret_cast< QFont*>(_v)); break;
        case 5: setRubberBand(*reinterpret_cast< RubberBand*>(_v)); break;
        case 6: setRubberBandPen(*reinterpret_cast< QPen*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #3
0
void QcGraphModel::append( QcGraphElement * e ) {
  if( _elems.count() ) {
    QcGraphElement *prev = _elems.last();
    prev->_next = e;
    e->_prev = prev;
  }
  _elems.append(e);
  Q_EMIT( appended(e) );
}
Example #4
0
/*!
  Append a point to the selection and update rubber band and tracker.
  The appended() signal is emitted.

  \param pos Additional point

  \sa isActive(), begin(), end(), move(), appended()
*/
void QwtPicker::append( const QPoint &pos )
{
    if ( d_data->isActive )
    {
        const int idx = d_data->pickedPoints.count();
        d_data->pickedPoints.resize( idx + 1 );
        d_data->pickedPoints[idx] = pos;

        updateDisplay();
        Q_EMIT appended( pos );
    }
}
Example #5
0
/*!
  Append a point to the selection and update rubberband and tracker.
  The appended() signal is emitted.

  \param pos Additional point

  \sa isActive, begin(), end(), move(), appended()
*/
void QwtPicker::append(const QPoint &pos)
{
    if ( d_data->isActive )
    {
        const int idx = d_data->selection.count();
        d_data->selection.resize(idx + 1);
        d_data->selection[idx] = pos;

        updateDisplay();

        emit appended(pos);
    }
}
int QwtPlotPicker::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtPicker::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: selected((*reinterpret_cast< const QPointF(*)>(_a[1]))); break;
        case 1: selected((*reinterpret_cast< const QRectF(*)>(_a[1]))); break;
        case 2: selected((*reinterpret_cast< const QVector<QPointF>(*)>(_a[1]))); break;
        case 3: appended((*reinterpret_cast< const QPointF(*)>(_a[1]))); break;
        case 4: moved((*reinterpret_cast< const QPointF(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
/*!
  Append a point to the selection and update rubberband and tracker.

  \param pos Additional point
  \sa isActive, begin(), end(), move(), appended()

  \note The appended(const QPoint &), appended(const QDoublePoint &)
        signals are emitted.
*/
void QwtPlotPicker::append( const QPoint &pos )
{
    QwtPicker::append( pos );
    Q_EMIT appended( invTransform( pos ) );
}
	void SignalAppender::append(const LoggingEvent &rEvent)
	{
		QString message(layout()->format(rEvent));
		emit appended(message);
	}