From e001973214143698f57fbacd9442ac4d9f1b32c9 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 2 Jun 2014 10:47:29 +0300 Subject: Misc fixes found while valgrinding. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If744721eff62f07f20bff95ca815ca80ca50fee1 Reviewed-by: Tomi Korpipää --- .../customitems/customitemgraph.cpp | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'examples/datavisualization/customitems/customitemgraph.cpp') 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(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"); } -- cgit v1.2.1