summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/datavisualization/customitems/customitemgraph.cpp25
-rw-r--r--examples/datavisualization/customitems/main.cpp2
-rw-r--r--examples/datavisualization/draggableaxes/axesinputhandler.cpp2
-rw-r--r--src/datavisualization/data/barrenderitem.cpp1
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp12
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp16
6 files changed, 40 insertions, 18 deletions
diff --git a/examples/datavisualization/customitems/customitemgraph.cpp b/examples/datavisualization/customitems/customitemgraph.cpp
index 07ee1b9a..96ce5e46 100644
--- a/examples/datavisualization/customitems/customitemgraph.cpp
+++ b/examples/datavisualization/customitems/customitemgraph.cpp
@@ -259,13 +259,17 @@ void CustomItemGraph::handleElementSelected(QAbstract3DGraph::ElementType type)
{
resetSelection();
if (type == QAbstract3DGraph::ElementCustomItem) {
- int index = m_graph->selectedCustomItemIndex();
QCustom3DItem *item = m_graph->selectedCustomItem();
QString text;
- text.setNum(index);
- text.append(": ");
- QStringList split = item->meshFile().split("/");
- text.append(split.last());
+ if (qobject_cast<QCustom3DLabel *>(item) != 0) {
+ text.append("Custom label: ");
+ } else {
+ QStringList split = item->meshFile().split("/");
+ text.append(split.last());
+ text.append(": ");
+ }
+ int index = m_graph->selectedCustomItemIndex();
+ text.append(QString::number(index));
m_textField->setText(text);
m_previouslyAnimatedItem = item;
m_previousScaling = item->scaling();
@@ -289,7 +293,16 @@ void CustomItemGraph::handleElementSelected(QAbstract3DGraph::ElementType type)
m_textField->setText(text);
} else if (type > QAbstract3DGraph::ElementSeries
&& type < QAbstract3DGraph::ElementCustomItem) {
- m_textField->setText("Axis");
+ int index = m_graph->selectedLabelIndex();
+ QString text;
+ if (type == QAbstract3DGraph::ElementAxisXLabel)
+ text.append("Axis X label: ");
+ else if (type == QAbstract3DGraph::ElementAxisYLabel)
+ text.append("Axis Y label: ");
+ else
+ text.append("Axis Z label: ");
+ text.append(QString::number(index));
+ m_textField->setText(text);
} else {
m_textField->setText("Nothing");
}
diff --git a/examples/datavisualization/customitems/main.cpp b/examples/datavisualization/customitems/main.cpp
index fe2d0edc..7f5dd01e 100644
--- a/examples/datavisualization/customitems/main.cpp
+++ b/examples/datavisualization/customitems/main.cpp
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
Q3DSurface *graph = new Q3DSurface();
QWidget *container = QWidget::createWindowContainer(graph);
- container->setMinimumSize(QSize(1280, 768));
+ container->setMinimumSize(QSize(800, 600));
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
diff --git a/examples/datavisualization/draggableaxes/axesinputhandler.cpp b/examples/datavisualization/draggableaxes/axesinputhandler.cpp
index 7b570e5c..f79f3d4e 100644
--- a/examples/datavisualization/draggableaxes/axesinputhandler.cpp
+++ b/examples/datavisualization/draggableaxes/axesinputhandler.cpp
@@ -130,6 +130,8 @@ void AxesInputHandler::handleAxisDragging()
distance = move.y() / m_speedModifier; // No need to use adjusted y move here
m_axisY->setRange(m_axisY->min() + distance, m_axisY->max() + distance);
break;
+ default:
+ break;
}
//! [9]
}
diff --git a/src/datavisualization/data/barrenderitem.cpp b/src/datavisualization/data/barrenderitem.cpp
index 2d9d3daa..9ceadbcd 100644
--- a/src/datavisualization/data/barrenderitem.cpp
+++ b/src/datavisualization/data/barrenderitem.cpp
@@ -66,6 +66,7 @@ void BarRenderSliceItem::setItem(const BarRenderItem &renderItem)
m_position = renderItem.position();
m_height = renderItem.height();
m_sliceLabel = QString();
+ delete m_sliceLabelItem;
m_sliceLabelItem = 0;
}
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index afa249c7..14523929 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -282,9 +282,9 @@ void Bars3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesList)
m_haveGradientSeries = false;
for (int i = 0; i < seriesCount; i++) {
QBar3DSeries *barSeries = static_cast<QBar3DSeries *>(seriesList[i]);
+ BarSeriesRenderCache *cache =
+ static_cast<BarSeriesRenderCache *>(m_renderCacheList.value(barSeries));
if (barSeries->isVisible()) {
- BarSeriesRenderCache *cache =
- static_cast<BarSeriesRenderCache *>(m_renderCacheList.value(barSeries));
if (noSelection
&& barSeries->selectedBar() != QBar3DSeries::invalidSelectionPosition()) {
if (selectionLabel() != cache->itemLabel())
@@ -296,7 +296,10 @@ void Bars3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesList)
m_haveUniformColorSeries = true;
else
m_haveGradientSeries = true;
+ } else {
+ cache->setVisualIndex(-1);
}
+
}
if (noSelection) {
if (!selectionLabel().isEmpty())
@@ -1830,10 +1833,13 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_selectedBar = selectedBar;
}
+ Drawer::LabelPosition position =
+ m_selectedBar->height() >= 0 ? Drawer::LabelOver : Drawer::LabelBelow;
+
m_drawer->drawLabel(*selectedBar, labelItem, viewMatrix, projectionMatrix,
zeroVector, identityQuaternion, selectedBar->height(),
m_cachedSelectionMode, m_labelShader,
- m_labelObj, activeCamera, true, false);
+ m_labelObj, activeCamera, true, false, position);
// Reset label update flag; they should have been updated when we get here
m_updateLabels = false;
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 0628a77e..f703ed97 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -1241,10 +1241,10 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle)
glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
// Put the RGBA value back to uint
- uint selectionId = clickedColor.x()
- + clickedColor.y() * greenMultiplier
- + clickedColor.z() * blueMultiplier
- + clickedColor.w() * alphaMultiplier;
+ uint selectionId = uint(clickedColor.x())
+ + uint(clickedColor.y()) * greenMultiplier
+ + uint(clickedColor.z()) * blueMultiplier
+ + uint(clickedColor.w()) * alphaMultiplier;
m_clickedPosition = selectionIdToSurfacePoint(selectionId);
@@ -2460,21 +2460,21 @@ QPoint Surface3DRenderer::selectionIdToSurfacePoint(uint id)
m_selectedCustomItemIndex = -1;
// Check for label and custom item selection
if (id / alphaMultiplier == labelRowAlpha) {
- m_selectedLabelIndex = id - (alphaMultiplier * labelRowAlpha);
+ m_selectedLabelIndex = id - (alphaMultiplier * uint(labelRowAlpha));
m_clickedType = QAbstract3DGraph::ElementAxisZLabel;
return Surface3DController::invalidSelectionPosition();
} else if (id / alphaMultiplier == labelColumnAlpha) {
- m_selectedLabelIndex = (id - (alphaMultiplier * labelColumnAlpha)) / greenMultiplier;
+ m_selectedLabelIndex = (id - (alphaMultiplier * uint(labelColumnAlpha))) / greenMultiplier;
m_clickedType = QAbstract3DGraph::ElementAxisXLabel;
return Surface3DController::invalidSelectionPosition();
} else if (id / alphaMultiplier == labelValueAlpha) {
- m_selectedLabelIndex = (id - (alphaMultiplier * labelValueAlpha)) / blueMultiplier;
+ m_selectedLabelIndex = (id - (alphaMultiplier * uint(labelValueAlpha))) / blueMultiplier;
m_clickedType = QAbstract3DGraph::ElementAxisYLabel;
return Surface3DController::invalidSelectionPosition();
} else if (id / alphaMultiplier == customItemAlpha) {
// Custom item selection
m_clickedType = QAbstract3DGraph::ElementCustomItem;
- m_selectedCustomItemIndex = id - (alphaMultiplier * customItemAlpha);
+ m_selectedCustomItemIndex = id - (alphaMultiplier * uint(customItemAlpha));
return Surface3DController::invalidSelectionPosition();
}