diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2014-04-03 12:06:54 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2014-04-03 12:14:05 +0300 |
commit | fdf486f4eb908c4471830b9a8708ebe7333b7bbe (patch) | |
tree | 47916e96a779401065a20044f65470cf8abf41f3 /src/datavisualization/engine/bars3drenderer.cpp | |
parent | 4633bb2121eb37397c7912ec9d54d7b3ba54d44d (diff) |
Axis label dragging support, part 2
Task-number: QTRD-2367
+ Added emitting selection signals
+ Added an example about creating an input handler for axis label dragging
- Snapshot for example docs to be taken
Change-Id: I641f4feb9e31c32023727b1c7c695324923accc4
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine/bars3drenderer.cpp')
-rw-r--r-- | src/datavisualization/engine/bars3drenderer.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index 9962d9e2..46df6464 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -2137,33 +2137,37 @@ Bars3DController::SelectionType Bars3DRenderer::isSelected(int row, int bar, int QPoint Bars3DRenderer::selectionColorToArrayPosition(const QVector4D &selectionColor) { - QPoint position; - if (selectionColor == selectionSkipColor - || (selectionColor.w() == labelRowAlpha - && !m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow)) - || (selectionColor.w() == labelColumnAlpha - && !m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionColumn))) { - position = Bars3DController::invalidSelectionPosition(); - } else if (selectionColor.w() == itemAlpha) { + QPoint position = Bars3DController::invalidSelectionPosition(); + m_clickedType = QAbstract3DGraph::ElementNone; + if (selectionColor.w() == itemAlpha) { // Normal selection item position = QPoint(int(selectionColor.x() + int(m_axisCacheZ.min())), int(selectionColor.y()) + int(m_axisCacheX.min())); + // Pass item clicked info to input handler + m_clickedType = QAbstract3DGraph::ElementSeries; } else if (selectionColor.w() == labelRowAlpha) { // Row selection - // Use column from previous selection in case we have row + column mode - GLint previousCol = qMax(0, m_selectedBarPos.y()); // Use 0 if previous is invalid - position = QPoint(int(selectionColor.x() + int(m_axisCacheZ.min())), previousCol); - // TODO: Pass label clicked info to input handler (implement in part 2) + if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow)) { + // Use column from previous selection in case we have row + column mode + GLint previousCol = qMax(0, m_selectedBarPos.y()); // Use 0 if previous is invalid + position = QPoint(int(selectionColor.x() + int(m_axisCacheZ.min())), previousCol); + } + // Pass label clicked info to input handler + m_clickedType = QAbstract3DGraph::ElementAxisZLabel; } else if (selectionColor.w() == labelColumnAlpha) { // Column selection - // Use row from previous selection in case we have row + column mode - GLint previousRow = qMax(0, m_selectedBarPos.x()); // Use 0 if previous is invalid - position = QPoint(previousRow, int(selectionColor.y()) + int(m_axisCacheX.min())); - // TODO: Pass label clicked info to input handler (implement in part 2) + if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionColumn)) { + // Use row from previous selection in case we have row + column mode + GLint previousRow = qMax(0, m_selectedBarPos.x()); // Use 0 if previous is invalid + position = QPoint(previousRow, int(selectionColor.y()) + int(m_axisCacheX.min())); + } + // Pass label clicked info to input handler + m_clickedType = QAbstract3DGraph::ElementAxisXLabel; } else if (selectionColor.w() == labelValueAlpha) { // Value selection position = Bars3DController::invalidSelectionPosition(); - // TODO: Pass label clicked info to input handler (implement in part 2) + // Pass label clicked info to input handler + m_clickedType = QAbstract3DGraph::ElementAxisYLabel; } return position; } |