@@ -36,32 +36,12 QTCOMMERCIALCHART_USE_NAMESPACE | |||
|
36 | 36 | MainWidget::MainWidget(QWidget *parent) : |
|
37 | 37 | QWidget(parent) |
|
38 | 38 | { |
|
39 | // Create buttons for ui | |
|
40 | m_buttonLayout = new QGridLayout(); | |
|
41 | ||
|
42 | QPushButton *addSliceButton = new QPushButton("add series"); | |
|
43 | connect(addSliceButton, SIGNAL(clicked()), this, SLOT(addSeries())); | |
|
44 | m_buttonLayout->addWidget(addSliceButton, 1, 0); | |
|
45 | ||
|
46 | QPushButton *removeSliceButton = new QPushButton("remove series"); | |
|
47 | connect(removeSliceButton, SIGNAL(clicked()), this, SLOT(removeSeries())); | |
|
48 | m_buttonLayout->addWidget(removeSliceButton, 2, 0); | |
|
49 | ||
|
50 | QPushButton *connectButton = new QPushButton("Connect markers"); | |
|
51 | connect(connectButton, SIGNAL(clicked()), this, SLOT(connectMarkers())); | |
|
52 | m_buttonLayout->addWidget(connectButton, 3, 0); | |
|
53 | ||
|
54 | QPushButton *disConnectButton = new QPushButton("Disconnect markers"); | |
|
55 | connect(disConnectButton, SIGNAL(clicked()), this, SLOT(disconnectMarkers())); | |
|
56 | m_buttonLayout->addWidget(disConnectButton, 4, 0); | |
|
57 | ||
|
58 | 39 | // Create chart view with the chart |
|
59 | 40 | m_chart = new QChart(); |
|
60 | 41 | m_chartView = new QChartView(m_chart, this); |
|
61 | 42 | |
|
62 | 43 | // Create layout for grid and detached legend |
|
63 | 44 | m_mainLayout = new QGridLayout(); |
|
64 | m_mainLayout->addLayout(m_buttonLayout, 0, 0); | |
|
65 | 45 | m_mainLayout->addWidget(m_chartView, 0, 1, 3, 1); |
|
66 | 46 | setLayout(m_mainLayout); |
|
67 | 47 | |
@@ -71,8 +51,10 MainWidget::MainWidget(QWidget *parent) : | |||
|
71 | 51 | addSeries(); |
|
72 | 52 | addSeries(); |
|
73 | 53 | |
|
54 | connectMarkers(); | |
|
55 | ||
|
74 | 56 | // Set the title and show legend |
|
75 | m_chart->setTitle("Legendmarker example"); | |
|
57 | m_chart->setTitle("Legendmarker example (click on legend)"); | |
|
76 | 58 | m_chart->legend()->setVisible(true); |
|
77 | 59 | m_chart->legend()->setAlignment(Qt::AlignBottom); |
|
78 | 60 |
General Comments 0
You need to be logged in to leave comments.
Login now