| 1168 | } |
| 1169 | |
| 1170 | void InfoElementPrivate::keyPressEvent(QKeyEvent* event) { |
| 1171 | if (m_suppressKeyPressEvents) { |
| 1172 | event->ignore(); |
| 1173 | return QGraphicsItem::keyPressEvent(event); |
| 1174 | } |
| 1175 | |
| 1176 | if (event->key() == Qt::Key_Right || event->key() == Qt::Key_Left) { |
| 1177 | int index; |
| 1178 | if (event->key() == Qt::Key_Right) |
| 1179 | index = 1; |
| 1180 | else |
| 1181 | index = -1; |
| 1182 | |
| 1183 | // problem: when curves have different number of samples, the points are anymore aligned |
| 1184 | // with the vertical line |
| 1185 | // find markerpoint to which the values matches (curvename is stored in connectionLineCurveName) |
| 1186 | for (int i = 0; i < q->markerPointsCount(); i++) { |
| 1187 | const auto* curve = q->markerpoints[i].curve; |
| 1188 | if (curve->name().compare(connectionLineCurveName) == 0) { |
| 1189 | if (!curve->xColumn()) |
| 1190 | return; |
| 1191 | auto rowCount = curve->xColumn()->rowCount(); |
| 1192 | m_index += index; |
| 1193 | if (m_index > rowCount - 1) |
| 1194 | m_index = rowCount - 1; |
| 1195 | if (m_index < 0) |
| 1196 | m_index = 0; |
| 1197 | if (curve->xColumn()->isNumeric()) |
| 1198 | q->setPositionLogical(curve->xColumn()->valueAt(m_index)); |
| 1199 | else |
| 1200 | q->setPositionLogical(curve->xColumn()->dateTimeAt(m_index).toMSecsSinceEpoch()); |
| 1201 | break; |
| 1202 | } |
| 1203 | } |
| 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | bool InfoElementPrivate::activate(QPointF mouseScenePos, double /*maxDist*/) { |
| 1208 | if (!isVisible()) |
nothing calls this directly
no test coverage detected