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 ++++++++++++++++------ examples/datavisualization/customitems/main.cpp | 2 +- .../draggableaxes/axesinputhandler.cpp | 2 ++ 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'examples') 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"); } 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] } -- cgit v1.2.3