| 22 | using namespace KDChart; |
| 23 | |
| 24 | MainWindow::MainWindow(QWidget *parent) |
| 25 | : QWidget(parent) |
| 26 | { |
| 27 | setupUi(this); |
| 28 | |
| 29 | m_curColumn = -1; |
| 30 | m_curOpacity = 0; |
| 31 | |
| 32 | auto *chartLayout = new QHBoxLayout(chartFrame); |
| 33 | m_chart = new Chart(); |
| 34 | chartLayout->addWidget(m_chart); |
| 35 | |
| 36 | m_model.loadFromCSV(":/data"); |
| 37 | |
| 38 | // Set up the diagram |
| 39 | m_lines = new LineDiagram(this); |
| 40 | m_lines->setModel(&m_model); |
| 41 | |
| 42 | auto *xAxis = new CartesianAxis(m_lines); |
| 43 | auto *yAxis = new CartesianAxis(m_lines); |
| 44 | xAxis->setPosition(KDChart::CartesianAxis::Bottom); |
| 45 | yAxis->setPosition(KDChart::CartesianAxis::Left); |
| 46 | m_lines->addAxis(xAxis); |
| 47 | m_lines->addAxis(yAxis); |
| 48 | |
| 49 | m_chart->coordinatePlane()->replaceDiagram(m_lines); |
| 50 | m_chart->setGlobalLeading(20, 20, 20, 20); |
| 51 | // Instantiate the timer |
| 52 | auto *timer = new QTimer(this); |
| 53 | connect(timer, SIGNAL(timeout()), this, SLOT(slot_timerFired())); |
| 54 | timer->start(30); |
| 55 | |
| 56 | // Change the cursor to IBeamCursor inside Chart widget. |
| 57 | m_chart->setCursor(Qt::IBeamCursor); |
| 58 | |
| 59 | // Install event filter on Chart to get the mouse position |
| 60 | m_chart->installEventFilter(this); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | Event filter for getting mouse position |
nothing calls this directly
no test coverage detected