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

Auto status change to "Under Review"

Approved

Status change > Approved

You need to be logged in to leave comments. Login now