summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-06-13 08:42:31 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-06-13 09:48:39 +0300
commitc89c18631f9d8770eb5db16a86043e6079cefaf3 (patch)
tree7481218166f37726106dadd074fab1ead9336f6a
parentd557920485f0cc1094908f72ce3fffcd55acd941 (diff)
Removed invokables from C++ api
Added missing properties to declarativebars. Renamed boolean properties to conform with naming conventions. Change-Id: Ide93c2a456713e1e77ba0a01ccdc110d00377e83 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Pasi Keränen <pasi.keranen@digia.com>
-rw-r--r--examples/qmlbarchart/qml/qmlbarchart/main.qml2
-rw-r--r--examples/rainfall/main.cpp2
-rw-r--r--examples/spectrum/spectrumapp/main.cpp2
-rw-r--r--examples/widget/chart.cpp4
-rw-r--r--src/datavis3d/engine/q3dbars.cpp30
-rw-r--r--src/datavis3d/engine/q3dbars.h70
-rw-r--r--src/datavis3dqml2/declarativebars.cpp16
-rw-r--r--src/datavis3dqml2/declarativebars.h25
-rw-r--r--src/datavis3dqml2/declarativebars_p.h2
9 files changed, 79 insertions, 74 deletions
diff --git a/examples/qmlbarchart/qml/qmlbarchart/main.qml b/examples/qmlbarchart/qml/qmlbarchart/main.qml
index 990c78e6..8007d66f 100644
--- a/examples/qmlbarchart/qml/qmlbarchart/main.qml
+++ b/examples/qmlbarchart/qml/qmlbarchart/main.qml
@@ -82,7 +82,7 @@ Item {
//x: mainview.x + mainview.width
//y: mainview.y
- grid: false
+ gridVisible: false
shadowQuality: Bars3D.ShadowNone
selectionMode: Bars3D.ModeNone
labelTransparency: Bars3D.TransparencyNone
diff --git a/examples/rainfall/main.cpp b/examples/rainfall/main.cpp
index 47acee0b..519ccdb6 100644
--- a/examples/rainfall/main.cpp
+++ b/examples/rainfall/main.cpp
@@ -96,7 +96,7 @@ RainfallChart::RainfallChart(Q3DBars *rainfall)
m_chart->setCameraPreset(PresetIsometricRightHigh);
// Disable grid
- m_chart->setGridEnabled(false);
+ m_chart->setGridVisible(false);
// Set window title
m_chart->setWindowTitle(QStringLiteral("Monthly rainfall in Northern Finland (2000-2012)"));
diff --git a/examples/spectrum/spectrumapp/main.cpp b/examples/spectrum/spectrumapp/main.cpp
index 4296a347..9865802a 100644
--- a/examples/spectrum/spectrumapp/main.cpp
+++ b/examples/spectrum/spectrumapp/main.cpp
@@ -87,7 +87,7 @@ MainApp::MainApp(Q3DBars *window)
{
m_chart->setupSampleSpace(SpectrumNumBands, SpectrumNumBands * 2);
// Disable grid
- m_chart->setGridEnabled(false);
+ m_chart->setGridVisible(false);
// Disable auto-scaling of height by defining tick count and step, even though we don't draw grid
// By setting count to 1 and step to the max we can get, we lock the scale of the bars.
m_chart->setTickCount(1, 1.0f);
diff --git a/examples/widget/chart.cpp b/examples/widget/chart.cpp
index c57a6752..5e7e98dc 100644
--- a/examples/widget/chart.cpp
+++ b/examples/widget/chart.cpp
@@ -272,12 +272,12 @@ void ChartModifier::changeShadowQuality(int quality)
void ChartModifier::setBackgroundEnabled(int enabled)
{
- m_chart->setBackgroundEnabled((bool)enabled);
+ m_chart->setBackgroundVisible((bool)enabled);
}
void ChartModifier::setGridEnabled(int enabled)
{
- m_chart->setGridEnabled((bool)enabled);
+ m_chart->setGridVisible((bool)enabled);
}
void ChartModifier::rotateX(int rotation)
diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp
index 2d10859d..f4626115 100644
--- a/src/datavis3d/engine/q3dbars.cpp
+++ b/src/datavis3d/engine/q3dbars.cpp
@@ -225,7 +225,7 @@ QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE
*/
/*!
- * Constructs a new 3D bar window. Parameters are not used unless instantiating from Qt Quick 2.
+ * Constructs a new 3D bar window.
*/
Q3DBars::Q3DBars()
: d_ptr(new Q3DBarsPrivate(this, geometry(), 0))
@@ -457,6 +457,8 @@ void Q3DBars::setSelectionMode(SelectionMode mode)
/*!
* \return \c SelectionMode.
+ *
+ * Returns selection mode.
*/
SelectionMode Q3DBars::selectionMode()
{
@@ -538,6 +540,8 @@ void Q3DBars::setLabelTransparency(LabelTransparency transparency)
/*!
* \return \c LabelTransparency.
+ *
+ * Returns label transparency.
*/
LabelTransparency Q3DBars::labelTransparency()
{
@@ -545,41 +549,43 @@ LabelTransparency Q3DBars::labelTransparency()
}
/*!
- * \property Q3DBars::grid
+ * \property Q3DBars::gridVisible
*
- * \a enable Flag to enable or disable grid. \c true by default.
+ * \a visible Flag to enable or disable grid. \c true by default.
*
* Sets grid drawing on or off.
*/
-void Q3DBars::setGridEnabled(bool enable)
+void Q3DBars::setGridVisible(bool visible)
{
- d_ptr->m_shared->setGridEnabled(enable);
+ d_ptr->m_shared->setGridEnabled(visible);
}
-bool Q3DBars::gridEnabled()
+bool Q3DBars::isGridVisible()
{
return d_ptr->m_shared->gridEnabled();
}
/*!
- * \property Q3DBars::background
+ * \property Q3DBars::backgroundVisible
*
- * \a enable Flag to enable or disable background. \c true by default.
+ * \a visible Flag to enable or disable background. \c true by default.
*
* Sets backround rendering on or off.
*/
-void Q3DBars::setBackgroundEnabled(bool enable)
+void Q3DBars::setBackgroundVisible(bool visible)
{
- d_ptr->m_shared->setBackgroundEnabled(enable);
+ d_ptr->m_shared->setBackgroundEnabled(visible);
}
-bool Q3DBars::backgroundEnabled()
+bool Q3DBars::isBackgroundVisible()
{
return d_ptr->m_shared->backgroundEnabled();
}
/*!
* \a quality Shadow quality from \c ShadowQuality. \c ShadowLow by default.
+ *
+ * Sets shadow quality.
*/
void Q3DBars::setShadowQuality(ShadowQuality quality)
{
@@ -588,6 +594,8 @@ void Q3DBars::setShadowQuality(ShadowQuality quality)
/*!
* \return \c ShadowQuality.
+ *
+ * Returns shadow quality.
*/
ShadowQuality Q3DBars::shadowQuality()
{
diff --git a/src/datavis3d/engine/q3dbars.h b/src/datavis3d/engine/q3dbars.h
index c63bfb6e..2bddffac 100644
--- a/src/datavis3d/engine/q3dbars.h
+++ b/src/datavis3d/engine/q3dbars.h
@@ -62,8 +62,8 @@ class QTENTERPRISE_DATAVIS3D_EXPORT Q3DBars : public Q3DWindow
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(float fontSize READ fontSize WRITE setFontSize)
- Q_PROPERTY(bool grid READ gridEnabled WRITE setGridEnabled)
- Q_PROPERTY(bool background READ backgroundEnabled WRITE setBackgroundEnabled)
+ Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible)
+ Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible)
public:
explicit Q3DBars();
@@ -71,68 +71,68 @@ public:
// Add a row of data. Each new row is added to the front of the sample space, moving previous
// rows back (if sample space is more than one row deep)
- Q_INVOKABLE void addDataRow(const QVector<float> &dataRow,
- const QString &labelRow = QString(),
- const QVector<QString> &labelsColumn = QVector<QString>());
+ void addDataRow(const QVector<float> &dataRow,
+ const QString &labelRow = QString(),
+ const QVector<QString> &labelsColumn = QVector<QString>());
// ownership of dataItems is transferred
- Q_INVOKABLE void addDataRow(const QVector<QDataItem*> &dataRow,
- const QString &labelRow = QString(),
- const QVector<QString> &labelsColumn = QVector<QString>());
+ void addDataRow(const QVector<QDataItem*> &dataRow,
+ const QString &labelRow = QString(),
+ const QVector<QString> &labelsColumn = QVector<QString>());
// ownership of dataRow is transferred
- Q_INVOKABLE void addDataRow(QDataRow *dataRow);
+ void addDataRow(QDataRow *dataRow);
// Add complete data set at a time, as a vector of data rows
- Q_INVOKABLE void addDataSet(const QVector< QVector<float> > &data,
- const QVector<QString> &labelsRow = QVector<QString>(),
- const QVector<QString> &labelsColumn = QVector<QString>());
+ void addDataSet(const QVector< QVector<float> > &data,
+ const QVector<QString> &labelsRow = QVector<QString>(),
+ const QVector<QString> &labelsColumn = QVector<QString>());
// ownership of dataItems is transferred
- Q_INVOKABLE void addDataSet(const QVector< QVector<QDataItem*> > &data,
- const QVector<QString> &labelsRow = QVector<QString>(),
- const QVector<QString> &labelsColumn = QVector<QString>());
+ void addDataSet(const QVector< QVector<QDataItem*> > &data,
+ const QVector<QString> &labelsRow = QVector<QString>(),
+ const QVector<QString> &labelsColumn = QVector<QString>());
// ownership of dataSet is transferred
- Q_INVOKABLE void addDataSet(QDataSet* dataSet);
+ void addDataSet(QDataSet* dataSet);
// bar thickness, spacing between bars, and is spacing relative to thickness or absolute
// y -component sets the thickness/spacing of z -direction
// With relative 0.0f means side-to-side, 1.0f = one thickness in between
- Q_INVOKABLE void setBarSpecs(QSizeF thickness = QSizeF(1.0f, 1.0f),
- QSizeF spacing = QSizeF(1.0f, 1.0f),
- bool relative = true);
+ void setBarSpecs(QSizeF thickness = QSizeF(1.0f, 1.0f),
+ QSizeF spacing = QSizeF(1.0f, 1.0f),
+ bool relative = true);
// bar type; bars (=cubes), pyramids, cones, cylinders, etc.
- Q_INVOKABLE void setBarType(BarStyle style, bool smooth = false);
+ void setBarType(BarStyle style, bool smooth = false);
// how many samples per row and column, and names for axes
- Q_INVOKABLE void setupSampleSpace(int samplesRow, int samplesColumn,
- const QString &labelRow = QString(),
- const QString &labelColumn = QString(),
- const QString &labelHeight = QString());
+ void setupSampleSpace(int samplesRow, int samplesColumn,
+ const QString &labelRow = QString(),
+ const QString &labelColumn = QString(),
+ const QString &labelHeight = QString());
// Select preset camera placement
- Q_INVOKABLE void setCameraPreset(CameraPreset preset);
+ void setCameraPreset(CameraPreset preset);
// Set camera rotation if you don't want to use the presets (in horizontal (-180...180) and
// vertical (0...90) (or (-90...90) if there are negative values) angles and distance in
// percentage (10...500))
- Q_INVOKABLE void setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance = 100);
+ void setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance = 100);
// Set theme (bar colors, shaders, window color, background colors, light intensity and text
// colors are affected)
- Q_INVOKABLE void setTheme(ColorTheme theme);
+ void setTheme(ColorTheme theme);
// Set color if you don't want to use themes. Set uniform to false if you want the (height)
// color to change from bottom to top
- Q_INVOKABLE void setBarColor(QColor baseColor, QColor heightColor, QColor depthColor,
- bool uniform = true);
+ void setBarColor(QColor baseColor, QColor heightColor, QColor depthColor,
+ bool uniform = true);
// Set tick count and step. Note; tickCount * step should be the maximum possible value of data
// set. Minimum is the absolute minimum possible value a bar can have. This is especially
// important to set if values can be negative.
- Q_INVOKABLE void setTickCount(GLint tickCount, GLfloat step, GLfloat minimum = 0.0f);
+ void setTickCount(GLint tickCount, GLfloat step, GLfloat minimum = 0.0f);
// override bar type with own mesh
- Q_INVOKABLE void setMeshFileName(const QString &objFileName);
+ void setMeshFileName(const QString &objFileName);
// TODO: light placement API
// Change selection mode; single bar, bar and row, bar and column, or all
@@ -156,8 +156,8 @@ public:
LabelTransparency labelTransparency();
// Enable or disable background grid
- void setGridEnabled(bool enable);
- bool gridEnabled();
+ void setGridVisible(bool visible);
+ bool isGridVisible();
// TODO: Do these need to be public? Where are they called from?
// Size
@@ -165,8 +165,8 @@ public:
void setHeight(const int height);
// Enable or disable background mesh
- void setBackgroundEnabled(bool enable);
- bool backgroundEnabled();
+ void setBackgroundVisible(bool visible);
+ bool isBackgroundVisible();
// Adjust shadow quality
void setShadowQuality(ShadowQuality quality);
diff --git a/src/datavis3dqml2/declarativebars.cpp b/src/datavis3dqml2/declarativebars.cpp
index c6419578..e62c2f80 100644
--- a/src/datavis3dqml2/declarativebars.cpp
+++ b/src/datavis3dqml2/declarativebars.cpp
@@ -194,23 +194,23 @@ DeclarativeBars::LabelTransparency DeclarativeBars::labelTransparency()
return DeclarativeBars::LabelTransparency(m_shared->labelTransparency());
}
-void DeclarativeBars::setGridEnabled(bool enable)
+void DeclarativeBars::setGridVisible(bool visible)
{
- m_cachedState->m_isGridEnabled = enable;
+ m_cachedState->m_isGridEnabled = visible;
m_cachedState->m_isGridSet = true;
}
-bool DeclarativeBars::gridEnabled()
+bool DeclarativeBars::isGridVisible()
{
return m_shared->gridEnabled();
}
-void DeclarativeBars::setBackgroundEnabled(bool enable)
+void DeclarativeBars::setBackgroundVisible(bool visible)
{
- m_shared->setBackgroundEnabled(enable);
+ m_shared->setBackgroundEnabled(visible);
}
-bool DeclarativeBars::backgroundEnabled()
+bool DeclarativeBars::isBackgroundVisible()
{
return m_shared->backgroundEnabled();
}
@@ -269,13 +269,13 @@ DeclarativeBars::SelectionMode DeclarativeBars::selectionMode()
return DeclarativeBars::SelectionMode(m_shared->selectionMode());
}
-void DeclarativeBars::setShadow(DeclarativeBars::ShadowQuality quality)
+void DeclarativeBars::setShadowQuality(DeclarativeBars::ShadowQuality quality)
{
m_cachedState->m_shadowQuality = QtDataVis3D::ShadowQuality(quality);
m_cachedState->m_isShadowQualitySet = true;
}
-DeclarativeBars::ShadowQuality DeclarativeBars::shadow()
+DeclarativeBars::ShadowQuality DeclarativeBars::shadowQuality()
{
return DeclarativeBars::ShadowQuality(m_shared->shadowQuality());
}
diff --git a/src/datavis3dqml2/declarativebars.h b/src/datavis3dqml2/declarativebars.h
index 74338949..c8c40073 100644
--- a/src/datavis3dqml2/declarativebars.h
+++ b/src/datavis3dqml2/declarativebars.h
@@ -62,8 +62,12 @@ class DeclarativeBars : public QQuickItem
Q_OBJECT
Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
Q_PROPERTY(LabelTransparency labelTransparency READ labelTransparency WRITE setLabelTransparency)
- Q_PROPERTY(ShadowQuality shadowQuality READ shadow WRITE setShadow)
- Q_PROPERTY(bool grid READ gridEnabled WRITE setGridEnabled)
+ Q_PROPERTY(ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality)
+ //Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
+ Q_PROPERTY(QFont font READ font WRITE setFont)
+ Q_PROPERTY(float fontSize READ fontSize WRITE setFontSize)
+ Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible)
+ Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible)
Q_PROPERTY(int width READ width WRITE setWidth)
Q_PROPERTY(int height READ height WRITE setHeight)
Q_ENUMS(SelectionMode)
@@ -187,23 +191,19 @@ public:
LabelTransparency labelTransparency();
// Enable or disable background grid
- void setGridEnabled(bool enable);
- bool gridEnabled();
+ void setGridVisible(bool visible);
+ bool isGridVisible();
// Enable or disable background mesh
- void setBackgroundEnabled(bool enable);
- bool backgroundEnabled();
+ void setBackgroundVisible(bool visible);
+ bool isBackgroundVisible();
// Adjust shadow quality
void setShadowQuality(ShadowQuality quality);
ShadowQuality shadowQuality();
- // Adjust shadow quality
- void setShadow(DeclarativeBars::ShadowQuality quality);
- DeclarativeBars::ShadowQuality shadow();
-
- protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
+protected:
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
};
@@ -228,6 +228,5 @@ private:
};
QTENTERPRISE_DATAVIS3D_END_NAMESPACE
-QTENTERPRISE_DATAVIS3D_USE_NAMESPACE
#endif
diff --git a/src/datavis3dqml2/declarativebars_p.h b/src/datavis3dqml2/declarativebars_p.h
index 62dcc708..2e723519 100644
--- a/src/datavis3dqml2/declarativebars_p.h
+++ b/src/datavis3dqml2/declarativebars_p.h
@@ -85,12 +85,10 @@ public:
bool m_isShadowQualitySet;
ShadowQuality m_shadowQuality;
-
bool m_isGridSet;
bool m_isGridEnabled;
};
QTENTERPRISE_DATAVIS3D_END_NAMESPACE
-QTENTERPRISE_DATAVIS3D_USE_NAMESPACE
#endif // DECLARATIVEBARS_P_H