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


C++ rangeChanged函数代码示例

本文整理汇总了C++中rangeChanged函数的典型用法代码示例。如果您正苦于以下问题:C++ rangeChanged函数的具体用法?C++ rangeChanged怎么用?C++ rangeChanged使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    init_time=0;
    data = -1;
    count_graph =0;
    dbaddr = "/home/uday/qtProjects/finaltrialqtplotting/sensorDatabase.db";
    ui->customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
    ui->customPlot->xAxis->setDateTimeFormat("hh:mm:ss");
    ui->customPlot->xAxis->setAutoTickStep(false);
    ui->customPlot->xAxis->setTickStep(3);
    ui->customPlot->axisRect()->setupFullAxesBox();


    ui->customPlot->xAxis->setLabel("Time(s)");
    ui->customPlot->yAxis->setLabel("Temperature");
    ui->customPlot->yAxis->setRange(0, 400);

    // make left and bottom axes transfer their ranges to right and top axes:
    connect(ui->customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->customPlot->xAxis2, SLOT(setRange(QCPRange)));
    connect(ui->customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->customPlot->yAxis2, SLOT(setRange(QCPRange)));

    // setup a timer that repeatedly calls MainWindow::realtimeDataSlot:
    connect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeDataSlot()));
    dataTimer.start(500); // Interval 0 means to refresh as fast as possible

}
开发者ID:hasantahir,项目名称:ECEN489-Fall2015,代码行数:29,代码来源:mainwindow.cpp

示例2: QWidget

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    connect(ui->widget->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->widget->xAxis2, SLOT(setRange(QCPRange)));
    connect(ui->widget->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->widget->yAxis2, SLOT(setRange(QCPRange)));

    ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables | QCP::iSelectLegend | QCP::iSelectAxes);
    ui->widget->axisRect()->setupFullAxesBox();

    ui->widget->plotLayout()->insertRow(0);
    ui->widget->plotLayout()->addElement(0, 0, new QCPPlotTitle(ui->widget, "Lagra"));

    ui->widget->xAxis->setLabel("x");
    ui->widget->yAxis->setLabel("y");

    ui->widget->legend->setVisible(true);

    QFont legendFont = font();
    legendFont.setPointSize(10);
    ui->widget->legend->setFont(legendFont);
    ui->widget->legend->setSelectedFont(legendFont);
    ui->widget->legend->setSelectableParts(QCPLegend::spNone);
}
开发者ID:Kupchinsky,项目名称:MV,代码行数:26,代码来源:widget.cpp

示例3: connect

void plotWidget::setupRealtimeData()
{
    if(this->m_dataType == img || this->m_dataType == nodata) {
        connect(&dataTimer, SIGNAL(timeout()), this, SLOT(SetRealtimeImg()));
        dataTimer.start(myApp::plotRefreshTimeSpan); // Interval 0 means to refresh as fast as possible
        return;
    }
    else {
        this->addGraph(); // blue line
        this->graph(0)->setPen(QPen(Qt::blue));
        this->graph(0)->setBrush(QBrush(QColor(240, 255, 200)));

        this->addGraph(); // blue dot
        this->graph(1)->setPen(QPen(QColor(255, 100, 0)));
        this->graph(1)->setLineStyle(QCPGraph::lsLine);
        this->graph(1)->setScatterStyle(QCPScatterStyle::ssDisc);

        this->xAxis->setTickLabelType(QCPAxis::ltDateTime);
        this->xAxis->setDateTimeFormat("hh:mm:ss");
        this->xAxis->setAutoTickStep(false);
        this->xAxis->setTickStep(2);
        this->axisRect()->setupFullAxesBox();

        // make left and bottom axes transfer their ranges to right and top axes:
        connect(this->xAxis, SIGNAL(rangeChanged(QCPRange)), this->xAxis2, SLOT(setRange(QCPRange)));
        connect(this->yAxis, SIGNAL(rangeChanged(QCPRange)), this->yAxis2, SLOT(setRange(QCPRange)));

        connect(&dataTimer, SIGNAL(timeout()), this, SLOT(SetRealtimeData()));
        dataTimer.start(myApp::plotRefreshTimeSpan); // Interval 0 means to refresh as fast as possible
        this->yAxis->setLabel(demoName);
        this->replot();
    }
}
开发者ID:Ranpop,项目名称:QT-Monitor,代码行数:33,代码来源:plotwidget.cpp

示例4: ui

ScatterWidget::ScatterWidget() :
    ui(new Ui::ScatterWidget)
{
    ui->setupUi(this);

    ui->scatter->xAxis->setTickLength(0, 5);
    ui->scatter->xAxis->setSubTickLength(0, 3);
    ui->scatter->axisRect()->setupFullAxesBox();
    ui->scatter->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
    ui->scatter->xAxis->setRange(-1, 1);
    ui->scatter->yAxis->setRange(-1, 1);

    // make left and bottom axes transfer their ranges to right and top axes:
    connect(ui->scatter->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->scatter->xAxis2, SLOT(setRange(QCPRange)));
    connect(ui->scatter->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->scatter->yAxis2, SLOT(setRange(QCPRange)));

    // connect slot that ties some axis selections together (especially opposite axes):
    connect(ui->scatter, &QCustomPlot::selectionChangedByUser, this, &ScatterWidget::selectionChanged);
    // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
    connect(ui->scatter, &QCustomPlot::mousePress, this, &ScatterWidget::mousePress);
    connect(ui->scatter, &QCustomPlot::mouseWheel, this, &ScatterWidget::mouseWheel);

    // Add Drag, Zoom and ... capabilities
    ui->scatter->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectItems | QCP::iSelectPlottables | QCP::iSelectAxes | QCP::iMultiSelect);
}
开发者ID:amiryanj,项目名称:smart-debug,代码行数:25,代码来源:scatterwidget.cpp

示例5: connect

void LeastSquare::PlotQuadr(QCustomPlot *customPlot)
{
    QString label1 = ui->XLabel->text();
    QString label2 = ui->YLabel->text();
    QString size_point = ui->size_point->text();
    if (size_point.isEmpty())
    {
        size_point = "8";
    }

    customPlot->addGraph();
    customPlot->graph(0)->setPen(QPen(Qt::black));
    customPlot->graph(0)->setLineStyle(QCPGraph::lsNone);
    customPlot->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, size_point.toInt()));
    customPlot->graph(0)->setData(x_values, y_values);

    customPlot->addGraph();
    customPlot->graph(1)->setPen(QPen(Qt::cyan));
    customPlot->graph(1)->setLineStyle(QCPGraph::lsLine);
    customPlot->graph(1)->setData(x_values, y_apprx);

    customPlot->xAxis2->setVisible(true);
    customPlot->xAxis2->setTickLabels(false);
    customPlot->yAxis2->setVisible(true);
    customPlot->yAxis2->setTickLabels(false);
    connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));
    connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));
    customPlot->xAxis->setLabel(label1);
    customPlot->yAxis->setLabel(label2);
    customPlot->graph(0)->rescaleAxes();
    customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
}
开发者ID:pekarchuk,项目名称:LeastSquares,代码行数:32,代码来源:leastsquare.cpp

示例6: connect

void MainWindow::setgraphs(QCustomPlot *customPlot,QString xlabel,QString ylabel,int rg){

    // configure bottom axis to show date and time instead of number:
        customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
       customPlot->xAxis->setDateTimeFormat("hh:mm:ss");
    // set a more compact font size for bottom and left axis tick labels:
       customPlot->xAxis->setTickLabelFont(QFont(QFont().family(), 8));
       customPlot->yAxis->setTickLabelFont(QFont(QFont().family(), 8));

       customPlot->xAxis->setLabel(xlabel);
       customPlot->yAxis->setLabel( ylabel);
    // scale x-axis in steps of 3:
      customPlot->xAxis->setAutoTickStep(false);
      customPlot->xAxis->setTickStep(1);
      customPlot->axisRect()->setupFullAxesBox();
      customPlot->legend->setVisible(true);
      customPlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignBottom|Qt::AlignLeft);

       customPlot->yAxis->setRange(0,rg);

      // make left and bottom axes transfer their ranges to right and top axes:
         connect( customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)),customPlot->xAxis2, SLOT(setRange(QCPRange)));
         connect( customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)),customPlot->yAxis2, SLOT(setRange(QCPRange)));

}
开发者ID:CourseReps,项目名称:ECEN489-Fall2015,代码行数:25,代码来源:mainwindow.cpp

示例7: connect

void MainWindow::setupIntegerTickStepCase(QCustomPlot *customPlot)
{
	customPlot->xAxis->setAutoTickStep(false);
	customPlot->yAxis->setAutoTickStep(false);
	connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(integerTickStepCase_xRangeChanged(QCPRange)));
	connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(integerTickStepCase_yRangeChanged(QCPRange)));
}
开发者ID:shenglonglinapple,项目名称:slin_code,代码行数:7,代码来源:mainwindow.cpp

示例8: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
{
  ui->setupUi(this);
  setupPlot();
  
  // configure scroll bars:
  // Since scroll bars only support integer values, we'll set a high default range of -500..500 and
  // divide scroll bar position values by 100 to provide a scroll range -5..5 in floating point
  // axis coordinates. if you want to dynamically grow the range accessible with the scroll bar,
  // just increase the the minimum/maximum values of the scroll bars as needed.
  ui->horizontalScrollBar->setRange(-500, 500);
  ui->verticalScrollBar->setRange(-500, 500);
  
  // create connection between axes and scroll bars:
  connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(horzScrollBarChanged(int)));
  connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vertScrollBarChanged(int)));
  connect(ui->plot->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisChanged(QCPRange)));
  connect(ui->plot->yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(yAxisChanged(QCPRange)));
  
  // initialize axis range (and scroll bar positions via signals we just connected):
  ui->plot->xAxis->setRange(0, 6, Qt::AlignCenter);
  ui->plot->yAxis->setRange(0, 10, Qt::AlignCenter);
}
开发者ID:alagoutte,项目名称:QCustomPlot,代码行数:25,代码来源:mainwindow.cpp

示例9: connect

void rpm1gauge::setupRealtimeDataDemo(QCustomPlot *customPlot)
{
  customPlot->addGraph();                                               //line graph
  customPlot->graph(0)->setPen(QPen(mColor));
  customPlot->addGraph();                                               //dot for new data
  customPlot->graph(1)->setPen(QPen(mColor));
  customPlot->graph(1)->setLineStyle(QCPGraph::lsNone);
  customPlot->graph(1)->setScatterStyle(QCPScatterStyle::ssStar);


  customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);             //time on x-axis

  customPlot->xAxis->setDateTimeFormat("hh:mm:ss");
  customPlot->xAxis->setAutoTickStep(false);
  customPlot->xAxis->setTickStep(30);                                   //30 second interval ticks
  customPlot->axisRect()->setupFullAxesBox();

  connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));
  connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));


  connect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeDataSlot()));           //runs rtds function every 300 ms

  dataTimer.start(1000);
}
开发者ID:dflass,项目名称:tenGauge-with-iOS-capability,代码行数:25,代码来源:rpm1gauge.cpp

示例10: connect

void viewGVpropertieslayout::setupPlot(QCustomPlot * plot) {

    // configure the plot for use

    // range
    plot->setInteraction(QCP::iRangeDrag, true);
    plot->setInteraction(QCP::iRangeZoom, true);

    // default to x-axis drag / zoom only
    plot->axisRect()->setRangeDrag(Qt::Horizontal);
    plot->axisRect()->setRangeZoom(Qt::Horizontal);

    // selections allowed
    plot->setInteraction(QCP::iSelectPlottables, true);
    plot->setInteraction(QCP::iSelectAxes, true);
    plot->setInteraction(QCP::iSelectLegend, true);

    // context menus for deleting graphs / reseting axes etc
    plot->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(plot, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint)));

    // make bottom and left axes transfer their ranges to top and right axes:
    connect(plot->xAxis, SIGNAL(rangeChanged(QCPRange)), plot->xAxis2, SLOT(setRange(QCPRange)));
    connect(plot->yAxis, SIGNAL(rangeChanged(QCPRange)), plot->yAxis2, SLOT(setRange(QCPRange)));


}
开发者ID:ajc158,项目名称:spinecreator,代码行数:27,代码来源:viewGVpropertieslayout.cpp

示例11: SIGNAL

/*!
 * \brief ScrollingTimeGraph::setupPlot Sets the plot up according to our standards.
 * \param mainWindow A pointer to the mainWindow, used for setting up a connection.
 * \param plot The plot which is being set up.
 * \param isMain A boolean for whether this is main or not.
 * \param primaryColor The color of the primary line.
 * \param secondaryColor The color of the secondary line.
 */
void ScrollingTimeGraph::setupPlot(QMainWindow* mainWindow, QCustomPlot *plot, bool isMain, QColor primaryColor, QColor secondaryColor)
{
    plot->addGraph(); // primary line
    plot->graph(0)->setPen(QPen(primaryColor));
    plot->graph(0)->setAntialiasedFill(false);
    plot->addGraph(); // secondary line
    plot->graph(1)->setPen(QPen(secondaryColor));
    plot->graph(0)->setChannelFillGraph(plot->graph(1));

    plot->addGraph(); // primary dot
    plot->graph(2)->setPen(QPen(primaryColor));
    plot->graph(2)->setLineStyle(QCPGraph::lsNone);
    plot->graph(2)->setScatterStyle(QCPScatterStyle::ssDisc);
    plot->addGraph(); // secondary dot
    plot->graph(3)->setPen(QPen(secondaryColor));
    plot->graph(3)->setLineStyle(QCPGraph::lsNone);
    plot->graph(3)->setScatterStyle(QCPScatterStyle::ssDisc);

    if(isMain)
    {
        plot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
        plot->xAxis->setDateTimeFormat("hh:mm:ss");
        plot->xAxis->setAutoTickStep(false);
        plot->xAxis->setTickStep(2);
        plot->axisRect()->setupFullAxesBox();
        // make left and bottom axes transfer their ranges to right and top axes:
        mainWindow->connect(plot->xAxis, SIGNAL(rangeChanged(QCPRange)), plot->xAxis2, SLOT(setRange(QCPRange)));
        mainWindow->connect(plot->yAxis, SIGNAL(rangeChanged(QCPRange)), plot->yAxis2, SLOT(setRange(QCPRange)));
    }
    else
    {
        plot->xAxis->setTickLabels(false);
        plot->yAxis->setTickLabels(false);
    }
}
开发者ID:FIGS-FESS,项目名称:FESSGUI,代码行数:43,代码来源:graph.cpp

示例12: connect

//-------------------------------------------------------------------------------------------------//
//--------------------GRAPHS SETTINGS-------------------------------------------------------------//
//-----------------------------------------------------------------------------------------------//
void RealTimePlotWindow::startGraph(QCustomPlot *accPlot, QCustomPlot *gyroPlot/*, QCustomPlot *an_gyroPlot*/)
{
    //------------------accelerometer graph-------------------
    accPlot->addGraph(); // blue line
    accPlot->graph(0)->setPen(QPen(Qt::blue));
    accPlot->addGraph(); // red line
    accPlot->graph(1)->setPen(QPen(Qt::red));
    accPlot->addGraph(); // red line
    accPlot->graph(2)->setPen(QPen(Qt::green));

    accPlot->xAxis->setAutoTickStep(false);
    accPlot->xAxis->setTickStep(1);
    accPlot->setTitle("Acceleration LIS3DH");
    accPlot->xAxis->setLabel("time [s]");
    accPlot->yAxis->setLabel("a [mg]");
    //create legend
    accPlot->legend->setVisible(true);
    accPlot->legend->setFont(QFont("Helvetica", 9));
    accPlot->legend->setPositionStyle(QCPLegend::psTopLeft);

    accPlot->graph(0)->setName("x-axis");
    accPlot->graph(1)->setName("y-axis");
    accPlot->graph(2)->setName("z-axis");


    //------------------gyroscope graph-------------------------
    gyroPlot->addGraph(); // blue line
    gyroPlot->graph(0)->setPen(QPen(Qt::blue));
    gyroPlot->addGraph(); // red line
    gyroPlot->graph(1)->setPen(QPen(Qt::red));
    gyroPlot->addGraph(); // red line
    gyroPlot->graph(2)->setPen(QPen(Qt::green));

    gyroPlot->xAxis->setAutoTickStep(false);
    gyroPlot->xAxis->setTickStep(1);
    gyroPlot->setTitle("Angular velocity L3G4200D");
    gyroPlot->xAxis->setLabel("time [s]");
    gyroPlot->yAxis->setLabel("w [dps]");
    //create legend
    gyroPlot->legend->setVisible(true);
    gyroPlot->legend->setFont(QFont("Helvetica", 9));
    gyroPlot->legend->setPositionStyle(QCPLegend::psTopLeft);

    gyroPlot->graph(0)->setName("x-axis");
    gyroPlot->graph(1)->setName("y-axis");
    gyroPlot->graph(2)->setName("z-axis");

    //gyroPlot->graph(0)->setBrush(QBrush(QPixmap("fill.png")));

    // make left and bottom axes transfer their ranges to right and top axes:
    connect(accPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), accPlot->xAxis2, SLOT(setRange(QCPRange)));
    connect(accPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), accPlot->yAxis2, SLOT(setRange(QCPRange)));

    // make left and bottom axes transfer their ranges to right and top axes:
    connect(gyroPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), gyroPlot->xAxis2, SLOT(setRange(QCPRange)));
    connect(gyroPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), gyroPlot->yAxis2, SLOT(setRange(QCPRange)));

}
开发者ID:GruszekG,项目名称:sbanalyzer,代码行数:61,代码来源:realtimeplotwindow.cpp

示例13: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // configurate scrollbars
    ui->horizontalScrollBar->setRange(-410, -290);
    ui->verticalScrollBar->setRange(-1300, -1240);

    // create connection between axes and scroll bars:
    connect(ui->widget->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisChanged(QCPRange)));
    connect(ui->widget->yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(yAxisChanged(QCPRange)));

    // initialize axis range und zooming
    ui->widget->xAxis->setRange(-4.1, -3.2, Qt::AlignCenter);
    ui->widget->yAxis->setRange(12.4, 13, Qt::AlignCenter);
    ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);

    // draw routes by selecting table row
    connect(ui->tableWidget_weekplans, SIGNAL(cellClicked(int, int)), this, SLOT(weekSelected(int, int)));
    connect(ui->tableWidget_dayplans, SIGNAL(cellClicked(int, int)), this, SLOT(daySelected(int, int)));

    // table of week plans
    ui->tableWidget_weekplans->setRowCount(constant::nweeks * constant::P);
    ui->tableWidget_weekplans->setColumnCount(3);

    QStringList Header;
    Header << "Work time" << "#Villages" << "#Households";
    ui->tableWidget_weekplans->setHorizontalHeaderLabels(Header);

    ui->tableWidget_weekplans->setColumnWidth(0,80);
    ui->tableWidget_weekplans->setColumnWidth(1,80);
    ui->tableWidget_weekplans->setColumnWidth(2,100);

    // table of day plans
    ui->tableWidget_dayplans->setRowCount(5);
    ui->tableWidget_dayplans->setColumnCount(5);

    Header.clear();
    Header << "Day" << "Villages" << "#Hh" << "Househols" << "Itime" << "Ttime" << "Wtime";
    ui->tableWidget_dayplans->setHorizontalHeaderLabels(Header);

    ui->tableWidget_dayplans->setColumnWidth(0,30);
    ui->tableWidget_dayplans->setColumnWidth(1,100);
    ui->tableWidget_dayplans->setColumnWidth(2,30);
    ui->tableWidget_dayplans->setColumnWidth(3,130);
    ui->tableWidget_dayplans->setColumnWidth(4,50);

    // show report window
    connect(ui->pbShow_report, SIGNAL(clicked()), this, SLOT(showReportWindow()));

    // default file selection
    MainWindow::on_buttonOpenVillages_clicked();
    MainWindow::on_buttonOpenRoads_clicked();
    MainWindow::on_buttonOpenHouseh_clicked();
}
开发者ID:tikhoncheva,项目名称:work,代码行数:57,代码来源:mainwindow.cpp

示例14: QT_VERSION_CHECK

int MainWindow::setupomegat(QCustomPlot *customPlot, int num)
{
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
  QMessageBox::critical(this, "", "You're using Qt < 4.7, the realtime data demo needs functions that are available with Qt 4.7 to work properly");
#endif
  const int a=5;

  if(num!=a){
      return num;
  }

  disconnect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimext()));
  disconnect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimexy()));
  disconnect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeyt()));
  disconnect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimefit()));
  disconnect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeomegat()));
  disconnect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimefifi()));

  customPlot->addGraph(); // blue line
  customPlot->graph(0)->setPen(QPen(Qt::blue));
  customPlot->graph(0)->setLineStyle(QCPGraph::lsLine);
  customPlot->graph(0)->setScatterStyle(QCPScatterStyle::ssNone);
  customPlot->graph(0)->setAntialiasedFill(true);

  customPlot->addGraph(); // blue dot
  customPlot->graph(1)->setPen(QPen(Qt::blue));
  customPlot->graph(1)->setLineStyle(QCPGraph::lsNone);
  customPlot->graph(1)->setScatterStyle(QCPScatterStyle::ssDisc);
  customPlot->graph(1)->setAntialiasedFill(true);

  customPlot->addGraph(); // red line
  customPlot->graph(2)->setPen(QPen(Qt::red));
  customPlot->graph(2)->setLineStyle(QCPGraph::lsLine);
  customPlot->graph(2)->setScatterStyle(QCPScatterStyle::ssNone);

  customPlot->addGraph(); // red dot
  customPlot->graph(3)->setPen(QPen(Qt::red));
  customPlot->graph(3)->setLineStyle(QCPGraph::lsNone);
  customPlot->graph(3)->setScatterStyle(QCPScatterStyle::ssDisc);


  ui->customplot->graph(0)->clearData();
  ui->customplot->graph(1)->clearData();
  ui->customplot->graph(2)->clearData();
  ui->customplot->graph(3)->clearData();

  // make left and bottom axes transfer their ranges to right and top axes:
  connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));
  connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));

  // setup a timer that repeatedly calls MainWindow::realtimeDataSlot:
  connect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeomegat()));
  dataTimer.start(50); // Interval 0 means to refresh as fast as possible

  return a;
}
开发者ID:Qbicz,项目名称:MUFB,代码行数:56,代码来源:mainwindow.cpp

示例15: QT_VERSION_CHECK

void mb_data_show::setupRealtimeDataDemo(void)
{
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
  QMessageBox::critical(this, "", "You're using Qt < 4.7, the realtime data demo needs functions that are available with Qt 4.7 to work properly");
#endif

  // include this section to fully disable antialiasing for higher performance:
  /*
  ui->customPlot->setNotAntialiasedElements(QCP::aeAll);
  QFont font;
  font.setStyleStrategy(QFont::NoAntialias);
  ui->customPlot->xAxis->setTickLabelFont(font);
  ui->customPlot->yAxis->setTickLabelFont(font);
  ui->customPlot->legend->setFont(font);
  */

  ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);

  ui->customPlot->addGraph(); // blue line
  ui->customPlot->graph(0)->setPen(QPen(Qt::blue));
/*
  ui->customPlot->graph(0)->setBrush(QBrush(QColor(240, 255, 200)));
  ui->customPlot->graph(0)->setAntialiasedFill(false);
*/
  ui->customPlot->addGraph(); // red line
  ui->customPlot->graph(1)->setPen(QPen(Qt::red));

  ui->customPlot->addGraph(); // green line
  ui->customPlot->graph(2)->setPen(QPen(Qt::green));
/*
  ui->customPlot->graph(0)->setChannelFillGraph(ui->customPlot->graph(1));

  ui->customPlot->addGraph(); // blue dot
  ui->customPlot->graph(2)->setPen(QPen(Qt::blue));
  ui->customPlot->graph(2)->setLineStyle(QCPGraph::lsNone);
  ui->customPlot->graph(2)->setScatterStyle(QCPScatterStyle::ssDisc);
  ui->customPlot->addGraph(); // red dot
  ui->customPlot->graph(3)->setPen(QPen(Qt::red));
  ui->customPlot->graph(3)->setLineStyle(QCPGraph::lsNone);
  ui->customPlot->graph(3)->setScatterStyle(QCPScatterStyle::ssDisc);
*/
  ui->customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
  ui->customPlot->xAxis->setDateTimeFormat("hh:mm:ss");
  ui->customPlot->xAxis->setAutoTickStep(false);
  ui->customPlot->xAxis->setTickStep(2);
  ui->customPlot->axisRect()->setupFullAxesBox();

  // make left and bottom axes transfer their ranges to right and top axes:
  connect(ui->customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->customPlot->xAxis2, SLOT(setRange(QCPRange)));
  connect(ui->customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->customPlot->yAxis2, SLOT(setRange(QCPRange)));

    // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
    connect(ui->customPlot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
    connect(ui->customPlot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
}
开发者ID:zpcaams,项目名称:osm,代码行数:55,代码来源:mb_data_show.cpp


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