##// END OF EJS Templates
Fix the close button on the graphs and multi selection in the same graph
trabillard -
r1054:f391b1d9fb19
parent child
Show More
@@ -164,9 +164,9 struct VisualizationGraphRenderingDelegate::VisualizationGraphRenderingDelegateP
164 initClosePixmapStyle(*m_ClosePixmap);
164 initClosePixmapStyle(*m_ClosePixmap);
165
165
166 // Connects pixmap selection to graph widget closing
166 // Connects pixmap selection to graph widget closing
167 QObject::connect(m_ClosePixmap, &QCPItemPixmap::selectionChanged,
167 QObject::connect(&m_Plot, &QCustomPlot::itemClick,
168 [&graphWidget](bool selected) {
168 [&graphWidget, this](auto item, auto mouseEvent) {
169 if (selected) {
169 if (item == m_ClosePixmap) {
170 graphWidget.close();
170 graphWidget.close();
171 }
171 }
172 });
172 });
@@ -181,15 +181,14 struct VisualizationGraphRenderingDelegate::VisualizationGraphRenderingDelegateP
181 initXAxisPixmapStyle(*m_XAxisPixmap);
181 initXAxisPixmapStyle(*m_XAxisPixmap);
182
182
183 // Connects pixmap selection to graph x-axis showing/hiding
183 // Connects pixmap selection to graph x-axis showing/hiding
184 QObject::connect(m_XAxisPixmap, &QCPItemPixmap::selectionChanged, [this]() {
184 QObject::connect(&m_Plot, &QCustomPlot::itemClick, [this](auto item, auto mouseEvent) {
185 if (m_XAxisPixmap->selected()) {
185 if (m_XAxisPixmap == item) {
186 // Changes the selection state and refreshes the x-axis
186 // Changes the selection state and refreshes the x-axis
187 m_ShowXAxis = !m_ShowXAxis;
187 m_ShowXAxis = !m_ShowXAxis;
188 updateXAxisState();
188 this->updateXAxisState();
189 m_Plot.layer(AXES_LAYER)->replot();
189 m_Plot.layer(AXES_LAYER)->replot();
190
190
191 // Deselects the x-axis pixmap and updates icon
191 // Deselects the x-axis pixmap and updates icon
192 m_XAxisPixmap->setSelected(false);
193 m_XAxisPixmap->setPixmap(
192 m_XAxisPixmap->setPixmap(
194 pixmap(m_ShowXAxis ? HIDE_AXIS_ICON_PATH : SHOW_AXIS_ICON_PATH));
193 pixmap(m_ShowXAxis ? HIDE_AXIS_ICON_PATH : SHOW_AXIS_ICON_PATH));
195 m_Plot.layer(OVERLAY_LAYER)->replot();
194 m_Plot.layer(OVERLAY_LAYER)->replot();
@@ -197,7 +197,7 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget
197 // Set qcpplot properties :
197 // Set qcpplot properties :
198 // - zoom is enabled
198 // - zoom is enabled
199 // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation
199 // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation
200 ui->widget->setInteractions(QCP::iRangeZoom | QCP::iSelectItems);
200 ui->widget->setInteractions(QCP::iRangeZoom);
201 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal | Qt::Vertical);
201 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal | Qt::Vertical);
202
202
203 // The delegate must be initialized after the ui as it uses the plot
203 // The delegate must be initialized after the ui as it uses the plot
General Comments 0
You need to be logged in to leave comments. Login now