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

}
Beispiel #2
0
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);
}
Beispiel #3
0
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();
    }
}
Beispiel #4
0
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);
}
Beispiel #5
0
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);
}
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)));

}
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)));
}
Beispiel #8
0
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);
}
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);
}
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)));


}
Beispiel #11
0
/*!
 * \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);
    }
}
//-------------------------------------------------------------------------------------------------//
//--------------------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)));

}
Beispiel #13
0
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();
}
Beispiel #14
0
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;
}
Beispiel #15
0
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()));
}
DrawInteraction::DrawInteraction(QWidget *parent) :
    QCustomPlot(parent)
{
    resize(600,400);

    statusBar = new QStatusBar(this);

    srand(QDateTime::currentDateTime().toTime_t());

    setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
                                      QCP::iSelectLegend | QCP::iSelectPlottables);
    xAxis->setRange(-8, 8);
    yAxis->setRange(-5, 5);
    axisRect()->setupFullAxesBox();

    plotLayout()->insertRow(0);
    plotLayout()->addElement(0, 0, new QCPPlotTitle(this, "Interaction Example"));

    xAxis->setLabel("x Axis");
    yAxis->setLabel("y Axis");
    legend->setVisible(true);
    QFont legendFont = font();
    legendFont.setPointSize(10);
    legend->setFont(legendFont);
    legend->setSelectedFont(legendFont);
    legend->setSelectableParts(QCPLegend::spItems); // legend box shall not be selectable, only legend items

    addRandomGraph();
    addRandomGraph();
    addRandomGraph();
    addRandomGraph();

    // connect slot that ties some axis selections together (especially opposite axes):
    connect(this, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
    // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
    connect(this, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
    connect(this, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));

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

    // connect some interaction slots:
    connect(this, SIGNAL(titleDoubleClick(QMouseEvent*,QCPPlotTitle*)), this, SLOT(titleDoubleClick(QMouseEvent*,QCPPlotTitle*)));
    connect(this, SIGNAL(axisDoubleClick(QCPAxis*,QCPAxis::SelectablePart,QMouseEvent*)), this, SLOT(axisLabelDoubleClick(QCPAxis*,QCPAxis::SelectablePart)));
    connect(this, SIGNAL(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*,QMouseEvent*)), this, SLOT(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*)));

    // connect slot that shows a message in the status bar when a graph is clicked:
    connect(this, SIGNAL(plottableClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*)));

    // setup policy and connect slot for context menu popup:
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint)));
}
Beispiel #17
0
QCustomPlotExt::QCustomPlotExt(QWidget *parent) :
    QCustomPlot(parent),
    marker(NULL)
{
    clearExt();
    setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
    axisRect()->setRangeDrag(Qt::Horizontal | Qt::Vertical);
    axisRect()->setRangeZoom(Qt::Horizontal | Qt::Vertical);
    connect(this, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel(QWheelEvent*)));
    connect(xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisRangeChanged(QCPRange)));
    connect(yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(yAxisRangeChanged(QCPRange)));
}
void MainWindow::setupTickLabelTest(QCustomPlot *customPlot)
{
	customPlot->axisRect()->setupFullAxesBox();
	customPlot->xAxis2->setTickLabels(true);
	customPlot->yAxis2->setTickLabels(true);
	connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));
	connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));
	customPlot->setPlottingHint(QCP::phCacheLabels, false);
	QTimer *timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), this, SLOT(tickLabelTestTimerSlot()));
	timer->start(1000);
	connect(customPlot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoveRotateTickLabels(QMouseEvent*)));
}
void histograma::ReDibujar(){
    int i=0;
    if(ui->red->isChecked()){
        ui->customPlot->addGraph();
        ui->customPlot->graph(i)->setPen(QPen(Qt::red)); // line color blue for first graph
        ui->customPlot->graph(i)->setBrush(QBrush(QColor(255, 0, 0, 20))); // first graph will be filled with translucent blue
        ui->customPlot->graph(i)->setData(*X, *R);
        i++;
     }

    if(ui->green->isChecked()){
        ui->customPlot->addGraph();
        ui->customPlot->graph(i)->setPen(QPen(Qt::green)); // line color blue for first graph
        ui->customPlot->graph(i)->setBrush(QBrush(QColor(0, 255, 0, 20))); // first graph will be filled with translucent blue
        ui->customPlot->graph(i)->setData(*X, *G);
        i++;
     }

    if(ui->blue->isChecked()){
        ui->customPlot->addGraph();
        ui->customPlot->graph(i)->setPen(QPen(Qt::blue)); // line color blue for first graph
        ui->customPlot->graph(i)->setBrush(QBrush(QColor(0, 0, 255, 20))); // first graph will be filled with translucent blue
        ui->customPlot->graph(i)->setData(*X, *B);
        i++;
     }

    if(ui->gray->isChecked()){
        ui->customPlot->addGraph();
        ui->customPlot->graph(i)->setPen(QPen(Qt::black)); // line color blue for first graph
        ui->customPlot->graph(i)->setBrush(QBrush(QColor(0, 0, 0, 20))); // first graph will be filled with translucent blue
        ui->customPlot->graph(i)->setData(*X, *Gr);
        i++;
     }




      ui->customPlot->xAxis2->setVisible(true);
      ui->customPlot->xAxis2->setTickLabels(false);
      ui->customPlot->yAxis2->setVisible(true);
      ui->customPlot->yAxis2->setTickLabels(false);
      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)));

      ui->customPlot->graph(0)->rescaleAxes();
      ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);

      ui->customPlot->replot();


}
Beispiel #20
0
void smart_plot::initGraph(QCustomPlot *customPlot)
{
    //Adds axes on the top and right
    customPlot->axisRect()->setupFullAxesBox();

    //Add title
    customPlot->plotLayout()->insertRow(0);
    QCPTextElement *title = new QCPTextElement(customPlot, tr("Open Files to Plot Data"), QFont("sans", 17, QFont::Bold));
    customPlot->plotLayout()->addElement(0, 0, title);

    //Add axes labels
    customPlot->xAxis->setLabel(tr("X Axis"));
    customPlot->yAxis->setLabel(tr("Y Axis"));

    customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
                                    QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iSelectItems | QCP::iMultiSelect);

    connect(customPlot, SIGNAL(selectionChangedByUser()),
            this, SLOT(selectionChanged()));

    connect(customPlot->xAxis,SIGNAL(rangeChanged(QCPRange)),
            this, SLOT(rangeChanged(QCPRange)));

    connect(customPlot, SIGNAL(mousePress(QMouseEvent*)),
            this, SLOT(mousePress(QMouseEvent*)));

    connect(title, SIGNAL(doubleClicked(QMouseEvent*)), this, SLOT(titleDoubleClick(QMouseEvent*)));

    connect(customPlot, SIGNAL(axisDoubleClick(QCPAxis*,QCPAxis::SelectablePart,QMouseEvent*)),
            this, SLOT(axisDoubleClick(QCPAxis*,QCPAxis::SelectablePart)));

    connect(customPlot, SIGNAL(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*,QMouseEvent*)),
            this, SLOT(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*)));

    // setup policy and connect slot for context menu popup:
    customPlot->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(customPlot, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint)));

    // make bottom x axis transfer its ranges to top x axis which is used for showing events
    connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));

    axisHandler.setAxisType(customPlot->xAxis, axis_handler::fixed);
    //Short Cuts!
    //Rescale to first selected plot
    //new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_R), this, SLOT(close()));
    //Rescale to first selected plot
    //new QShortcut(Qt::Key_Delete, this, SLOT(selected_remove()));
}
Beispiel #21
0
//--------------------------------------------------------------
bool ofxMuiNumberData::setRange(ofxMuiRange _range, int index) {
    if(isValidIndex(index)) {
        if(hasRange && _range == ranges[index]) return;

        
        //cout << "in range " << _range.getMin() << "/" << _range.getMax() << endl;
        
        hasRange = true;
        ranges[index] = _range;

        bool _boundsChanged = false;
        bool _rangeChanged = false;
        bool _valueChanged = false;

        checkRange(_boundsChanged, _rangeChanged, index);
        constrainValue(_valueChanged, index);

        // callbacks
        if(_valueChanged) dataChanged(index);
        rangeChanged(index);
        if(_boundsChanged) boundsChanged(index);
    

       // cout << "out range " << _range.getMin() << "/" << _range.getMax() << endl;

        
        return true;
    } else {
        return false;
    }
}
Beispiel #22
0
OscilloscopeWidget::OscilloscopeWidget() : height( 400 ), width( 600 )
{

  QVBoxLayout* verticalLayout = new QVBoxLayout( this );

  verticalLayout->setContentsMargins( 0, 0, 0, 0 );

  this->customPlot = new QCustomPlot();

  verticalLayout->addWidget( customPlot );

  customPlot->addGraph();
  customPlot->graph( 0 )->setPen( QPen( Qt::cyan ) );
  customPlot->graph( 0 )->setLineStyle( QCPGraph::lsStepLeft );

  customPlot->xAxis->setTickLabelType( QCPAxis::ltNumber );
  customPlot->xAxis->setAutoTickStep( false );
  customPlot->xAxis->setTickStep( 0.5 );

  customPlot->axisRect()->setupFullAxesBox();

  customPlot->yAxis->setRange( -100.0f, 5000.0f );

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

}
Beispiel #23
0
PrintDialog::PrintDialog(QWidget *parent, capture_file *cf) :
    QDialog(parent),
    pd_ui_(new Ui::PrintDialog),
    cur_printer_(NULL),
    cur_painter_(NULL),
    preview_(new QPrintPreviewWidget(&printer_)),
    print_bt_(new QPushButton(tr("&Print..."))),
    cap_file_(cf)
{
    if (!cf) done(QDialog::Rejected); // ...or assert?

    pd_ui_->setupUi(this);

    pd_ui_->previewLayout->insertWidget(0, preview_, Qt::AlignTop);

    preview_->setMinimumWidth(preview_->height() / 2);
    preview_->setToolTip(pd_ui_->zoomLabel->toolTip());

    // XXX Make these configurable
    header_font_.setFamily("Times");
    header_font_.setPointSizeF(header_font_.pointSizeF() * 0.8);
    packet_font_ = wsApp->monospaceFont();
    packet_font_.setPointSizeF(packet_font_.pointSizeF() * 0.8);

    memset(&print_args_, 0, sizeof(print_args_));
    memset(&stream_ops_, 0, sizeof(stream_ops_));

    /* Init the export range */
    packet_range_init(&print_args_.range, cap_file_);
    /* Default to displayed packets */
    print_args_.range.process_filtered = TRUE;

    stream_ops_.print_preamble = print_preamble_pd;
    stream_ops_.print_line     = print_line_pd;
    stream_ops_.new_page       = new_page_pd;

    stream_.data = this;
    stream_.ops = &stream_ops_;
    print_args_.stream = &stream_;

    gchar *display_basename = g_filename_display_basename(cap_file_->filename);
    printer_.setDocName(display_basename);
    g_free(display_basename);

    pd_ui_->rangeGroupBox->initRange(&print_args_.range);

    pd_ui_->buttonBox->addButton(print_bt_, QDialogButtonBox::ActionRole);
    pd_ui_->buttonBox->addButton(tr("Page &Setup..."), QDialogButtonBox::ResetRole);
    print_bt_->setDefault(true);

    connect(preview_, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintPreview(QPrinter*)));
    connect(pd_ui_->rangeGroupBox, SIGNAL(rangeChanged()),
            this, SLOT(checkValidity()));
    connect(pd_ui_->formatGroupBox, SIGNAL(formatChanged()),
            this, SLOT(checkValidity()));
    connect(pd_ui_->formFeedCheckBox, SIGNAL(toggled(bool)),
            preview_, SLOT(updatePreview()));

    checkValidity();
}
void MainWindow::setupRealtimeDataDemo(QCustomPlot *customPlot)
{
#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
  demoName = "Real Time";
    server.show();
  // include this section to fully disable antialiasing for higher performance:
  /*
  customPlot->setNotAntialiasedElements(QCP::aeAll);
  QFont font;
  font.setStyleStrategy(QFont::NoAntialias);
  customPlot->xAxis->setTickLabelFont(font);
  customPlot->yAxis->setTickLabelFont(font);
  customPlot->legend->setFont(font);
  */
  customPlot->addGraph(); // blue line
  customPlot->graph(0)->setPen(QPen(Qt::blue));
  customPlot->graph(0)->setBrush(QBrush(QColor(240, 255, 200)));
  customPlot->graph(0)->setAntialiasedFill(false);
  customPlot->addGraph(); // red line
  customPlot->graph(1)->setPen(QPen(Qt::red));
  customPlot->graph(0)->setChannelFillGraph(customPlot->graph(1));

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

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

  // 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(realtimeDataSlot()));
  dataTimer.start(0); // Interval 0 means to refresh as fast as possible
}
void DataShowWidget::setupUi(){
	ui_qcustomplot = new QCustomPlot(this);

	ui_qcustomplot->addGraph(); // blue line
	ui_qcustomplot->graph(0)->setPen(QPen(Qt::blue));

	ui_qcustomplot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
	ui_qcustomplot->xAxis->setDateTimeFormat("hh:mm:ss");
	ui_qcustomplot->xAxis->setAutoTickStep(true);

	ui_qcustomplot->axisRect()->setupFullAxesBox();
	ui_qcustomplot->yAxis->setRange(0, 6);

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


	QVBoxLayout * ui_layout_main = new QVBoxLayout(this);
	ui_layout_main->setContentsMargins(5, 0, 5, 0);
	QHBoxLayout * ui_layout_top = new QHBoxLayout(this);

	ui_layout_top->addWidget(&ui_show_title);
	ui_layout_top->addWidget(&ui_show_data);
	ui_layout_top->addWidget(&ui_show_unit);
	

	QSpacerItem* tanhuang = new QSpacerItem(1600,20,QSizePolicy::Preferred);
	ui_layout_top->addSpacerItem(tanhuang);

	ui_layout_main->addLayout(ui_layout_top);
	ui_layout_main->addWidget(ui_qcustomplot);

	this->setLayout(ui_layout_main);

	ui_show_title.setText(tr("<b>ËÙ¶È:<\b>"));
	ui_show_data.setText(tr("0.0"));
	ui_show_unit.setText(tr("cm/s"));
	ui_show_title.setMaximumHeight(20);
	ui_show_data.setMaximumHeight(20);
	ui_show_unit.setMaximumHeight(20);

	this->setAutoFillBackground(true);

	QPalette palette;
	palette.setColor(QPalette::Background, QColor(255, 255, 255));
	this->setPalette(palette);
}
SettingDialog::SettingDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingDialog)
{
    ui->setupUi(this);
    steps = 1.0;
    x_pos = 0;
    y_pos = 0;
    z_pos = 0;
    ui->frame->setEnabled(false);
    this->setWindowTitle(tr("打印机设置"));
    ui->cusplot->xAxis->setLabel(tr("时间轴"));
    ui->cusplot->yAxis->setLabel(tr("温度值℃"));
    ui->cusplot->yAxis->setRange(0, 100);

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

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

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

    QSettings* psetting = new QSettings("printerConfig.ini",QSettings::IniFormat);
    psetting->beginGroup("preheart");
    ui->lineEdit_2->setText(psetting->value("preTime").toString());
    ui->lineEdit_3->setText(psetting->value("preTemp").toString());
    psetting->endGroup();
    QSettings* psetting1 = new QSettings("printerConfig.ini",QSettings::IniFormat);
    psetting1->beginGroup("slice");
    ui->filamentDiameter->setText(psetting1->value("diameter").toString());
    ui->extrusionWidth->setText(psetting1->value("widthE").toString());
    ui->printSpeed->setText(psetting1->value("printSpeed").toString());
    psetting1->endGroup();

    exculuerSpeed = 5000;
    exculuerSpeed = ui->excurdSpeed->text().toInt();
}
void AmplitudeWidget::setRange(double newRange)
{
  if(_range != newRange) {
    _range = bound(newRange, 0.0, 1.0);
    setOffset(offset());
    emit rangeChanged(_range);
  }
}
Beispiel #28
0
RgbImageWindow::RgbImageWindow(HyperCube *cube, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::RgbImageWindow)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowIcon(QIcon(":/rgb/icons/icons/RGB.png"));
    m_cube = cube;
    initCustomplotSettings();

//    ui->toolBar->addAction(QIcon(":/rgb/icons/icons/zoom_in.png"),"Zoom In",ui->widget,SLOT(ZoomInSetter()));
//    ui->toolBar->addAction(QIcon(":/rgb/icons/icons/zoom_out.png"),"Zoom Out",ui->widget,SLOT(ZoomOutSetter()));
//    ui->toolBar->addAction(QIcon(":/rgb/icons/icons/move.png"),"Zoom Scroll",ui->widget,SLOT(MoveSetter()));
//    QObject::connect(ui->widget,SIGNAL(updateSize()),this,SLOT(updateSize()));
    QObject::connect(ui->widget->xAxis, SIGNAL(rangeChanged(QCPRange,QCPRange)),this,SLOT(xRangeChanged(QCPRange,QCPRange)));
    QObject::connect(ui->widget->yAxis, SIGNAL(rangeChanged(QCPRange,QCPRange)),this,SLOT(yRangeChanged(QCPRange,QCPRange)));
}
bool ViewLevelHistogram::handleKey(Key key) {
    if (_state.navItem == State::NavItem::Param0 && handleUpDown(_state.level.histogram.range, key)) {
        rangeChanged();
        return true;
    }

    return ViewLevel::handleKey(key);
}
void PaneWidget::setRange(const QRectF & range)
{
    if (range != m_range) {
        m_range = range;
        emit rangeChanged(m_range);
        update();
    }
}