From 49e4968b880ae4d1ff414a730329002aef562058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 30 May 2013 12:13:15 +0300 Subject: QML2 support added (draft) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I025750cf21352af1222c8941540be8b97960c8a3 Change-Id: I025750cf21352af1222c8941540be8b97960c8a3 Reviewed-by: Miikka Heikkinen Reviewed-by: Mika Salmela Reviewed-by: Pasi Keränen --- src/datavis3d/engine/q3dbars.h | 70 +++++++++++++++--------------- src/datavis3d/engine/q3dmaps.h | 44 +++++++++---------- src/datavis3d/engine/qdataset.h | 12 ++--- src/datavis3dqml2/datavis3dqml2.pro | 4 +- src/datavis3dqml2/datavis3dqml2_plugin.cpp | 8 ++-- src/src.pro | 4 +- 6 files changed, 73 insertions(+), 69 deletions(-) diff --git a/src/datavis3d/engine/q3dbars.h b/src/datavis3d/engine/q3dbars.h index 4425c568..8101b940 100644 --- a/src/datavis3d/engine/q3dbars.h +++ b/src/datavis3d/engine/q3dbars.h @@ -68,85 +68,87 @@ 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) - void addDataRow(const QVector &dataRow, - const QString &labelRow = QString(), - const QVector &labelsColumn = QVector()); + Q_INVOKABLE void addDataRow(const QVector &dataRow, + const QString &labelRow = QString(), + const QVector &labelsColumn = QVector()); // ownership of dataItems is transferred - void addDataRow(const QVector &dataRow, - const QString &labelRow = QString(), - const QVector &labelsColumn = QVector()); + Q_INVOKABLE void addDataRow(const QVector &dataRow, + const QString &labelRow = QString(), + const QVector &labelsColumn = QVector()); // ownership of dataRow is transferred - void addDataRow(QDataRow *dataRow); + Q_INVOKABLE void addDataRow(QDataRow *dataRow); // Add complete data set at a time, as a vector of data rows - void addDataSet(const QVector< QVector > &data, - const QVector &labelsRow = QVector(), - const QVector &labelsColumn = QVector()); + Q_INVOKABLE void addDataSet(const QVector< QVector > &data, + const QVector &labelsRow = QVector(), + const QVector &labelsColumn = QVector()); // ownership of dataItems is transferred - void addDataSet(const QVector< QVector > &data, - const QVector &labelsRow = QVector(), - const QVector &labelsColumn = QVector()); + Q_INVOKABLE void addDataSet(const QVector< QVector > &data, + const QVector &labelsRow = QVector(), + const QVector &labelsColumn = QVector()); // ownership of dataSet is transferred - void addDataSet(QDataSet* dataSet); + Q_INVOKABLE 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 - void setBarSpecs(QSizeF thickness = QSizeF(1.0f, 1.0f), - QSizeF spacing = QSizeF(1.0f, 1.0f), - bool relative = true); + Q_INVOKABLE 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. - void setBarType(BarStyle style, bool smooth = false); + Q_INVOKABLE void setBarType(BarStyle style, bool smooth = false); // override bar type with own mesh - void setMeshFileName(const QString &objFileName); + Q_INVOKABLE void setMeshFileName(const QString &objFileName); // how many samples per row and column, and names for axes - void setupSampleSpace(int samplesRow, int samplesColumn, const QString &labelRow = QString(), - const QString &labelColumn = QString(), - const QString &labelHeight = QString()); + Q_INVOKABLE void setupSampleSpace(int samplesRow, int samplesColumn, + const QString &labelRow = QString(), + const QString &labelColumn = QString(), + const QString &labelHeight = QString()); // Select preset camera placement - void setCameraPreset(CameraPreset preset); + Q_INVOKABLE void setCameraPreset(CameraPreset preset); // Set camera rotation if you don't want to use the presets (in horizontal (-180...180) and // vertical (0...90) angles and distance in percentage (10...500)) - void setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance = 100); + Q_INVOKABLE 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) - void setTheme(ColorTheme theme); + Q_INVOKABLE 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 - void setBarColor(QColor baseColor, QColor heightColor, QColor depthColor, bool uniform = true); + Q_INVOKABLE void setBarColor(QColor baseColor, QColor heightColor, QColor depthColor, + bool uniform = true); // TODO: valon siirto / asetus // Change selection mode; single bar, bar and row, bar and column, or all - void setSelectionMode(SelectionMode mode); + Q_INVOKABLE void setSelectionMode(SelectionMode mode); // Set window title - void setWindowTitle(const QString &title); + Q_INVOKABLE void setWindowTitle(const QString &title); // Font size adjustment (should it be in enum (smallest, smaller, small, normal, large, larger, largest), or just GLfloat? - void setFontSize(GLfloat fontsize); + Q_INVOKABLE void setFontSize(GLfloat fontsize); // Set font - void setFont(const QFont &font); + Q_INVOKABLE void setFont(const QFont &font); // Label transparency adjustment - void setLabelTransparency(LabelTransparency transparency); + Q_INVOKABLE void setLabelTransparency(LabelTransparency transparency); // Enable or disable background grid - void setGridEnabled(bool enable); + Q_INVOKABLE void setGridEnabled(bool enable); // Adjust shadow quality - void setShadowQuality(ShadowQuality quality); + Q_INVOKABLE void setShadowQuality(ShadowQuality quality); // 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. - void setTickCount(GLint tickCount, GLfloat step, GLfloat minimum = 0.0f); + Q_INVOKABLE void setTickCount(GLint tickCount, GLfloat step, GLfloat minimum = 0.0f); protected: #if defined(Q_OS_ANDROID) diff --git a/src/datavis3d/engine/q3dmaps.h b/src/datavis3d/engine/q3dmaps.h index 61373b7a..de59f27e 100644 --- a/src/datavis3d/engine/q3dmaps.h +++ b/src/datavis3d/engine/q3dmaps.h @@ -80,73 +80,73 @@ public: // Add data item. New data item is appended to old data. // ownership of data is transferred - bool addDataItem(QDataItem *dataItem); + Q_INVOKABLE bool addDataItem(QDataItem *dataItem); // Add data set. New data is appended to old data. // ownership of data is transferred - bool addData(const QVector &data); + Q_INVOKABLE bool addData(const QVector &data); // ownership of data is transferred - bool addData(const QDataRow &data); + Q_INVOKABLE bool addData(const QDataRow &data); // Add data set. Old data is deleted. // ownership of data is transferred - bool setData(const QVector &data); + Q_INVOKABLE bool setData(const QVector &data); // ownership of data is transferred - bool setData(QDataRow *data); + Q_INVOKABLE bool setData(QDataRow *data); // bar specifications; base thickness in x, y and z, enum to indicate which direction is increased with value // TODO: Start using thickness also in adjustment direction; use it as a relative value. // For example, in AdjustAll mode setting thickness to (0.1f, 1.0f, 0.5f) would apply value to // x at 10%, y at 100% and z at 50%. If a dimension is not included, given thickness states its absolute value. - void setBarSpecs(const QVector3D &thickness = QVector3D(1.0f, 1.0f, 1.0f), - AdjustmentDirection direction = AdjustHeight); + Q_INVOKABLE void setBarSpecs(const QVector3D &thickness = QVector3D(1.0f, 1.0f, 1.0f), + AdjustmentDirection direction = AdjustHeight); // bar type; bars (=cubes), pyramids, cones, cylinders, balls, etc. - void setBarType(BarStyle style, bool smooth = false); + Q_INVOKABLE void setBarType(BarStyle style, bool smooth = false); // override bar type with own mesh - void setMeshFileName(const QString &objFileName); + Q_INVOKABLE void setMeshFileName(const QString &objFileName); // Select preset camera placement - void setCameraPreset(CameraPreset preset); + Q_INVOKABLE void setCameraPreset(CameraPreset preset); // Set camera rotation if you don't want to use the presets (in horizontal (-180...180) and // vertical (0...90) angles and distance in percentage (10...500)) - void setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance = 100); + Q_INVOKABLE 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) - void setTheme(ColorTheme theme); + Q_INVOKABLE 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 - void setBarColor(QColor baseColor, QColor heightColor, bool uniform = true); + Q_INVOKABLE void setBarColor(QColor baseColor, QColor heightColor, bool uniform = true); // TODO: valon siirto / asetus // Change selection mode; single bar, bar and row, bar and column, or all - void setSelectionMode(SelectionMode mode); + Q_INVOKABLE void setSelectionMode(SelectionMode mode); // Set window title - void setWindowTitle(const QString &title); + Q_INVOKABLE void setWindowTitle(const QString &title); // Font size adjustment (should it be in enum (smallest, smaller, small, normal, large, larger, largest), or just GLfloat? - void setFontSize(GLfloat fontsize); + Q_INVOKABLE void setFontSize(GLfloat fontsize); // Set font - void setFont(const QFont &font); + Q_INVOKABLE void setFont(const QFont &font); // Label transparency adjustment - void setLabelTransparency(LabelTransparency transparency); + Q_INVOKABLE void setLabelTransparency(LabelTransparency transparency); // Enable or disable background grid - void setGridEnabled(bool enable); + Q_INVOKABLE void setGridEnabled(bool enable); // Set area specs - void setAreaSpecs(const QRect &areaRect, const QImage &image); + Q_INVOKABLE void setAreaSpecs(const QRect &areaRect, const QImage &image); // Set area image - void setImage(const QImage &image); + Q_INVOKABLE void setImage(const QImage &image); // Adjust shadow quality - void setShadowQuality(ShadowQuality quality); + Q_INVOKABLE void setShadowQuality(ShadowQuality quality); protected: #if defined(Q_OS_ANDROID) diff --git a/src/datavis3d/engine/qdataset.h b/src/datavis3d/engine/qdataset.h index 02269a27..f0061ad8 100644 --- a/src/datavis3d/engine/qdataset.h +++ b/src/datavis3d/engine/qdataset.h @@ -62,12 +62,12 @@ public: explicit QDataSet(); ~QDataSet(); - void setLabels(const QString &xAxis = QString(), - const QString &zAxis = QString(), - const QString &yAxis = QString(), - const QVector &labelsRow = QVector(), - const QVector &labelsColumn = QVector()); - void addRow(QDataRow *row); + Q_INVOKABLE void setLabels(const QString &xAxis = QString(), + const QString &zAxis = QString(), + const QString &yAxis = QString(), + const QVector &labelsRow = QVector(), + const QVector &labelsColumn = QVector()); + Q_INVOKABLE void addRow(QDataRow *row); private: QScopedPointer d_ptr; diff --git a/src/datavis3dqml2/datavis3dqml2.pro b/src/datavis3dqml2/datavis3dqml2.pro index 7f42e45d..07a20fc4 100644 --- a/src/datavis3dqml2/datavis3dqml2.pro +++ b/src/datavis3dqml2/datavis3dqml2.pro @@ -1,11 +1,13 @@ TEMPLATE = lib TARGET = datavis3dqml2 -QT += qml quick +QT += qml quick datavis3d CONFIG += qt plugin TARGET = $$qtLibraryTarget($$TARGET) uri = com.digia.QtDataVis3D +staticlib:DEFINES+=QTENTERPRISE_DATAVIS3D_STATICLIB + # Input INCLUDEPATH += ../datavis3d/engine diff --git a/src/datavis3dqml2/datavis3dqml2_plugin.cpp b/src/datavis3dqml2/datavis3dqml2_plugin.cpp index 12f6f3f1..3376f360 100644 --- a/src/datavis3dqml2/datavis3dqml2_plugin.cpp +++ b/src/datavis3dqml2/datavis3dqml2_plugin.cpp @@ -50,14 +50,14 @@ void Datavis3dqml2Plugin::registerTypes(const char *uri) { // @uri com.digia.QtDataVis3D qmlRegisterType(uri, 1, 0, "DataVisView"); -// qmlRegisterType(uri, 1, 0, "3DBars"); -// qmlRegisterType(uri, 1, 0, "3DMaps"); + qmlRegisterType(uri, 1, 0, "3DBars"); + qmlRegisterType(uri, 1, 0, "3DMaps"); qmlRegisterType(uri, 1, 0, "DataItem"); qmlRegisterType(uri, 1, 0, "DataRow"); -// qmlRegisterType(uri, 1, 0, "DataSet"); + qmlRegisterType(uri, 1, 0, "DataSet"); } -#include "moc_datavis3dqml2_plugin.cpp" +//#include "moc_datavis3dqml2_plugin.cpp" QTENTERPRISE_DATAVIS3D_END_NAMESPACE diff --git a/src/src.pro b/src/src.pro index d6bef647..d25722eb 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += datavis3d #\ - #datavis3dqml2 +SUBDIRS += datavis3d \ + datavis3dqml2 -- cgit v1.2.3