Hello community, here is the log from the commit of package kqtquickcharts for openSUSE:Factory checked in at 2014-07-16 16:17:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kqtquickcharts (Old) and /work/SRC/openSUSE:Factory/.kqtquickcharts.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "kqtquickcharts" Changes: -------- --- /work/SRC/openSUSE:Factory/kqtquickcharts/kqtquickcharts.changes 2014-06-19 13:19:08.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kqtquickcharts.new/kqtquickcharts.changes 2014-07-16 16:18:13.000000000 +0200 @@ -1,0 +2,7 @@ +Thu Jul 10 22:19:53 UTC 2014 - cgiboudeaux@gmx.com + +- Update to 4.13.80 + * KDE 4.14 Beta 1 release + * See http://www.kde.org/announcements/announce-4.14-beta1.php + +------------------------------------------------------------------- Old: ---- kqtquickcharts-4.13.2.tar.xz New: ---- kqtquickcharts-4.13.80.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kqtquickcharts.spec ++++++ --- /var/tmp/diff_new_pack.nfr6Y5/_old 2014-07-16 16:18:14.000000000 +0200 +++ /var/tmp/diff_new_pack.nfr6Y5/_new 2014-07-16 16:18:14.000000000 +0200 @@ -17,7 +17,7 @@ Name: kqtquickcharts -Version: 4.13.2 +Version: 4.13.80 Release: 0 Summary: Plugin to render beautiful and interactive graphs License: LGPL-2.1+ ++++++ kqtquickcharts-4.13.2.tar.xz -> kqtquickcharts-4.13.80.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/README.md new/kqtquickcharts-4.13.80/README.md --- old/kqtquickcharts-4.13.2/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/README.md 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,46 @@ +kqtquickcharts +============== + +Beautiful and interactive charts for Qt Quick 1.0 + +## Installation + +### Prerequesites + +**kqtquicharts** depends on the following libaries: + + * KDElibs >= 4.10.0 + * Qt >= 4.8 (but not Qt 5.x) + * CMake >= 2.8.9 + +### Building + +Once the required libaries are installed **kqtquickcharts** can be built with: + + $ mkdir build + $ cd build + $ cmake .. + $ make + +To be usable the components have to be installed: + + # make install + +### Runtime dependencies + +At runtime, the following additional libaries have to be present: + + * KDE-runtime >= 4.10.0 + +## Try it out + +There are a few example projects in the `demo` folder. They are directly +runable in **qmlviewer**. Make sure to pass the required import folders +to it: + + $ cd demo/minimal + $ qmlviewer -I /usr/lib64/kde4/imports/ main.qml + +Replace the last line on 32-bit systems with: + + $ qmlviewer -I /usr/lib/kde4/imports/ main.qml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/demo/dynamicdata/Chart.qml new/kqtquickcharts-4.13.80/demo/dynamicdata/Chart.qml --- old/kqtquickcharts-4.13.2/demo/dynamicdata/Chart.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/demo/dynamicdata/Chart.qml 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,54 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +import QtQuick 1.1 +import org.kde.charts 0.1 + +BarChart { + id: chart + model: ChartModel { + columns: chart.dimensions.length + } + width: parent.width + height: 400 + dimensions: [ + Dimension { + id: funDimension + color: "#ffd500" + dataColumn: 0 + minimumValue: 0.0 + maximumValue: 1.0 + label: "Fun" + precision: 0 + unit:" %" + unitFactor: 100.0 + }, + Dimension { + id: profitDimension + color: "#ff0000" + dataColumn: 1 + minimumValue: 0.0 + maximumValue: 1.0 + label: "Profit" + precision: 0 + unit:" %" + unitFactor: 100.0 + } + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/demo/dynamicdata/TableView.qml new/kqtquickcharts-4.13.80/demo/dynamicdata/TableView.qml --- old/kqtquickcharts-4.13.2/demo/dynamicdata/TableView.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/demo/dynamicdata/TableView.qml 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,96 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +import QtQuick 1.1 +import org.kde.charts 0.1 + +Rectangle { + id: root + property variant chart + + width: chart.model.columns * (listView.cellWidth + listView.spacing) + listView.spacing + + color: "#fff" + + ListView { + id: listView + anchors { + fill: parent + leftMargin: spacing + topMargin: spacing + bottomMargin: spacing + } + clip: true + model: root.chart.model.rows + + property real cellHeight: theme.defaultFont.mSize.height * 2 + property real cellWidth: 4 * cellHeight + spacing: 3 + + header: Component { + Row { + spacing: 3 + height: childrenRect.height + listView.spacing + Repeater { + model: root.chart.dimensions.length + Rectangle { + color: "#bbb" + height: listView.cellHeight + width: listView.cellWidth + LegendItem { + anchors.centerIn: parent + dimension: root.chart.dimensions[index] + } + } + + } + } + } + + delegate: Row { + id: rowDelegate + property int row: index + height: childrenRect.height + spacing: 3 + Repeater { + model: chart.model.columns + ValueEdit { + id: cell + property int column: index + height: listView.cellHeight + width: listView.cellWidth + value: root.chart.model.value(row, column) + onValueChanged: { + if (root.chart.model.value(row, column) != value) { + root.chart.model.setValue(row, column, value) + } + } + Connections { + target: root.chart.model + onRecordChanged: { + if (row == rowDelegate.row) { + cell.value = root.chart.model.value(row, column) + } + } + } + } + } + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/demo/dynamicdata/ValueEdit.qml new/kqtquickcharts-4.13.80/demo/dynamicdata/ValueEdit.qml --- old/kqtquickcharts-4.13.2/demo/dynamicdata/ValueEdit.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/demo/dynamicdata/ValueEdit.qml 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,84 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +import QtQuick 1.1 +import org.kde.plasma.components 0.1 as PlasmaComponents +import org.kde.plasma.extras 0.1 as PlasmaExtras + +Rectangle { + color: "#ddd" + id: root + property real value: 0.0 + property bool editing: false + property real internalPadding: theme.defaultFont.mSize.height * 0.3 + + Text { + anchors { + left: parent.left + right: parent.right + leftMargin: internalPadding + rightMargin: internalPadding + verticalCenter: parent.verticalCenter + } + + verticalAlignment: Text.Center + text: value + visible: !editing + } + + MouseArea { + anchors.fill: parent + onClicked: { + editing = true + if (loader.item) { + loader.item.forceActiveFocus() + } + } + } + + PlasmaExtras.ConditionalLoader { + id: loader + anchors.fill: parent + when: editing + source: Component { + PlasmaComponents.TextField { + anchors.fill: parent + opacity: root.editing? 1: 0 + text: root.value + Component.onCompleted: { + forceActiveFocus() + } + onTextChanged: { + var value = parseFloat(text) + if (!isNaN(value)) { + root.value = value + } + } + onActiveFocusChanged: { + if (!activeFocus) { + root.editing = false + } + } + onAccepted: { + root.editing = false + } + } + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/demo/dynamicdata/main.qml new/kqtquickcharts-4.13.80/demo/dynamicdata/main.qml --- old/kqtquickcharts-4.13.2/demo/dynamicdata/main.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/demo/dynamicdata/main.qml 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,116 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +import QtQuick 1.1 +import org.kde.plasma.components 0.1 as PlasmaComponents +import org.kde.charts 0.1 + +Column { + width: 1000 + height: 500 + spacing: 15 + + Component.onCompleted: { + for (var i = 0; i < 25; i++) { + appendRecord() + } + } + + function randomizeRecord(row) { + for (var column = 0; column < chart.model.columns; column++) { + var value = parseInt(100 * Math.random()) / 100 + chart.model.setValue(row, column, value) + } + } + + function appendRecord() { + chart.model.appendRecord() + randomizeRecord(chart.model.rows - 1) + var row = chart.model.rows - 1 + } + + function insertRecord() { + chart.model.insertRecord(0) + randomizeRecord(0) + } + + function removeRecord() { + if (chart.model.rows > 0) { + var row = chart.model.rows - 1 + chart.model.removeRecord(row) + } + } + + PlasmaComponents.ToolBar { + id: toolbar + tools: Row { + spacing: 4 + PlasmaComponents.ToolButton { + anchors.verticalCenter: parent.verticalCenter + iconSource: "edit-table-insert-row-below" + text: "Append record" + onClicked: appendRecord() + } + PlasmaComponents.ToolButton { + anchors.verticalCenter: parent.verticalCenter + iconSource: "edit-table-insert-row-above" + text: "Insert record" + onClicked: insertRecord() + } + PlasmaComponents.ToolButton { + anchors.verticalCenter: parent.verticalCenter + iconSource: "edit-table-delete-row" + text: "Remove record" + onClicked: removeRecord() + } + } + } + + Item { + height: parent.height - toolbar.height - parent.spacing + width: parent.width + + Row { + anchors { + fill: parent + margins: 20 + } + + spacing: 40 + + TableView { + id: tableView + height: parent.height + chart: chart + } + + Rectangle { + color: "white" + width: parent.width - tableView.width - parent.spacing + height: parent.height + + Chart { + id: chart + anchors.fill: parent + padding: 10 + } + } + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/demo/minimal/main.qml new/kqtquickcharts-4.13.80/demo/minimal/main.qml --- old/kqtquickcharts-4.13.2/demo/minimal/main.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/demo/minimal/main.qml 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,95 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +import QtQuick 1.1 +import org.kde.charts 0.1 + +Rectangle { + color: "white" + width: 800 + height: 400 + + ChartModel { + id: chartModel + columns: 2 + + Record { + values: [0.1, 0.2] + } + Record { + values: [0.25, 0.3] + } + Record { + values: [0.5, 0.5] + } + Record { + values: [1.0, 0.75] + } + } + + Column { + anchors.fill: parent + anchors.margins: 20 + spacing: 20 + + LineChart { + model: chartModel + width: parent.width + height: parent.height - legend.height - parent.spacing + pitch: 180 + dimensions: [ + Dimension { + id: funDimension + color: "#ffd500" + dataColumn: 0 + minimumValue: 0.0 + maximumValue: 1.0 + label: "Fun" + precision: 0 + unit:" %" + unitFactor: 100.0 + }, + Dimension { + id: profitDimension + color: "#ff0000" + dataColumn: 1 + minimumValue: 0.0 + maximumValue: 1.0 + label: "Profit" + precision: 0 + unit:" %" + unitFactor: 100.0 + } + ] + } + + Row { + id: legend + spacing: 30 + anchors.horizontalCenter: parent.horizontalCenter + + LegendItem { + dimension: funDimension + } + LegendItem { + dimension: profitDimension + } + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/src/CMakeLists.txt new/kqtquickcharts-4.13.80/src/CMakeLists.txt --- old/kqtquickcharts-4.13.2/src/CMakeLists.txt 2014-01-30 17:43:56.000000000 +0100 +++ new/kqtquickcharts-4.13.80/src/CMakeLists.txt 2014-04-10 09:51:33.000000000 +0200 @@ -9,6 +9,7 @@ dimension.cpp chartplugin.cpp chartcore.cpp + chartmodel.cpp barchartcore.cpp barchartsegment.cpp linechartcore.cpp @@ -16,6 +17,7 @@ linechartpainter.cpp linechartpoint.cpp chartforegroundpainter.cpp + record.cpp ) automoc4_add_library(kqtquickcharts SHARED ${kqtquickcharts_SRCS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/src/chartmodel.cpp new/kqtquickcharts-4.13.80/src/chartmodel.cpp --- old/kqtquickcharts-4.13.2/src/chartmodel.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/src/chartmodel.cpp 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,170 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +#include "chartmodel.h" + +#include "record.h" + +ChartModel::ChartModel(QObject* parent) : + QAbstractTableModel(parent), + m_columns(0) +{ +} + +QDeclarativeListProperty<Record> ChartModel::records() +{ + return QDeclarativeListProperty<Record>(this, 0, &ChartModel::appendRecord, &ChartModel::countRecords, &ChartModel::recordAt, &ChartModel::clearRecords); +} + +int ChartModel::columns() const +{ + return m_columns; +} + +void ChartModel::setColumns(int columns) +{ + if (columns != m_columns) + { + m_columns = columns; + reset(); + emit columnsChanged(); + } +} + +int ChartModel::rows() const +{ + return m_records.count(); +} + +qreal ChartModel::value(int row, int column) const +{ + if (row >= m_records.count()) + return 0.0; + return m_records.at(row)->value(column); +} + +void ChartModel::appendRecord() +{ + insertRecord(rows(), new Record()); +} + +void ChartModel::insertRecord(int row) +{ + insertRecord(row, new Record()); +} + +void ChartModel::removeRecord(int row) +{ + beginRemoveRows(QModelIndex(), row, row); + Record* record = m_records.at(row); + record->disconnect(this); + m_records.removeAt(row); + record->deleteLater(); + endRemoveRows(); + emit rowsChanged(); +} + +void ChartModel::setValue(int row, int column, qreal value) +{ + while (row >= m_records.count()) + { + appendRecord(); + } + m_records.at(row)->setValue(column, value); +} + +int ChartModel::rowCount(const QModelIndex& parent) const +{ + if (parent.isValid()) + return 0; + return m_records.count(); +} + +int ChartModel::columnCount(const QModelIndex& parent) const +{ + if (parent.isValid()) + return 0; + return m_columns; +} + +QVariant ChartModel::data(const QModelIndex& index, int role) const +{ + if (index.parent().isValid()) + return QVariant(); + if (role != Qt::DisplayRole) + return QVariant(); + return QVariant(value(index.row(), index.column())); +} + +void ChartModel::onRecordChanged(Record* record) +{ + const int row = m_records.indexOf(record); + emit dataChanged(index(row, 0), index(row, columns() - 1)); + emit recordChanged(row); +} + +void ChartModel::insertRecord(int row, Record *record) +{ + beginInsertRows(QModelIndex(), row, row); + record->setParent(this); + connect(record, SIGNAL(valuesChanged(Record*)), SLOT(onRecordChanged(Record*))); + m_records.insert(row, record); + endInsertRows(); + emit rowsChanged(); +} + +void ChartModel::appendRecord(QDeclarativeListProperty<Record>* list, Record* record) +{ + ChartModel* chartModel = qobject_cast<ChartModel*>(list->object); + if (chartModel) + { + chartModel->insertRecord(chartModel->rows(), record); + } +} + +int ChartModel::countRecords(QDeclarativeListProperty<Record>* list) +{ + ChartModel* chartModel = qobject_cast<ChartModel*>(list->object); + if (chartModel) + { + return chartModel->m_records.count(); + } + return -1; +} + +Record* ChartModel::recordAt(QDeclarativeListProperty<Record>* list, int index) +{ + ChartModel* chartModel = qobject_cast<ChartModel*>(list->object); + if (chartModel) + { + return chartModel->m_records.at(index); + } + return 0; +} + +void ChartModel::clearRecords(QDeclarativeListProperty<Record>* list) +{ + ChartModel* chartModel = qobject_cast<ChartModel*>(list->object); + if (chartModel) + { + qDeleteAll(chartModel->m_records); + chartModel->m_records.clear(); + emit chartModel->rowsChanged(); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/src/chartmodel.h new/kqtquickcharts-4.13.80/src/chartmodel.h --- old/kqtquickcharts-4.13.2/src/chartmodel.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/src/chartmodel.h 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,66 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +#ifndef CHARTMODEL_H +#define CHARTMODEL_H + +#include <QAbstractTableModel> + +#include <QDeclarativeListProperty> + +class Record; + +class ChartModel : public QAbstractTableModel +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<Record> records READ records CONSTANT) + Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) + Q_PROPERTY(int rows READ rows NOTIFY rowsChanged) + Q_CLASSINFO("DefaultProperty", "records") +public: + QDeclarativeListProperty<Record> records(); + int columns() const; + void setColumns(int columns); + int rows() const; + Q_INVOKABLE void appendRecord(); + Q_INVOKABLE void insertRecord(int row); + Q_INVOKABLE void removeRecord(int row); + Q_INVOKABLE qreal value(int row, int column) const; + Q_INVOKABLE void setValue(int row, int column, qreal value); + explicit ChartModel(QObject* parent = 0); + int rowCount(const QModelIndex& parent) const; + int columnCount(const QModelIndex& parent) const; + QVariant data(const QModelIndex& index, int role) const; +signals: + void columnsChanged(); + void rowsChanged(); + void recordChanged(int row); +private slots: + void onRecordChanged(Record* record); +private: + void insertRecord(int row, Record* record); + static void appendRecord(QDeclarativeListProperty<Record>* list, Record* record); + static int countRecords(QDeclarativeListProperty<Record>* list); + static Record* recordAt(QDeclarativeListProperty<Record>* list, int index); + static void clearRecords(QDeclarativeListProperty<Record>* list); + QList<Record*> m_records; + int m_columns; +}; + +#endif // CHARTMODEL_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/src/chartplugin.cpp new/kqtquickcharts-4.13.80/src/chartplugin.cpp --- old/kqtquickcharts-4.13.2/src/chartplugin.cpp 2014-01-30 17:43:56.000000000 +0100 +++ new/kqtquickcharts-4.13.80/src/chartplugin.cpp 2014-04-10 09:51:33.000000000 +0200 @@ -22,28 +22,33 @@ #include <qdeclarative.h> #include <QAbstractTableModel> -#include "dimension.h" #include "barchartcore.h" #include "barchartsegment.h" +#include "chartforegroundpainter.h" +#include "chartcore.h" +#include "chartmodel.h" +#include "dimension.h" #include "linechartcore.h" #include "linechartbackgroundpainter.h" #include "linechartpainter.h" #include "linechartpoint.h" -#include "chartforegroundpainter.h" +#include "record.h" void ChartPlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.charts")); qmlRegisterType<Dimension>(uri, 0, 1, "Dimension"); - qmlRegisterType<ChartCore>(uri, 0, 1, "ChartCore"); qmlRegisterType<BarChartCore>(uri, 0, 1, "BarChartCore"); qmlRegisterType<BarChartSegment>(uri, 0, 1, "BarChartSegment"); + qmlRegisterType<ChartCore>(uri, 0, 1, "ChartCore"); + qmlRegisterType<ChartForegroundPainter>(uri, 0, 1, "ChartForegroundPainter"); qmlRegisterType<LineChartCore>(uri, 0, 1, "LineChartCore"); qmlRegisterType<LineChartBackgroundPainter>(uri, 0, 1, "LineChartBackgroundPainter"); qmlRegisterType<LineChartPainter>(uri, 0, 1, "LineChartPainter"); qmlRegisterType<LineChartPoint>(uri, 0, 1, "LineChartPoint"); - qmlRegisterType<ChartForegroundPainter>(uri, 0, 1, "ChartForegroundPainter"); + qmlRegisterType<ChartModel>(uri, 0, 1, "ChartModel"); + qmlRegisterType<Record>(uri, 0, 1, "Record"); qmlRegisterUncreatableType<QAbstractTableModel>(uri, 0, 1, "QAbstractTableModel", "abstract class"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/src/record.cpp new/kqtquickcharts-4.13.80/src/record.cpp --- old/kqtquickcharts-4.13.2/src/record.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/src/record.cpp 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +#include "record.h" + +Record::Record(QObject* parent) : + QObject(parent) +{ +} + +QVariantList Record::values() const +{ + return m_values; +} + +void Record::setValues(const QVariantList& values) +{ + if (values != m_values) + { + m_values = values; + emit valuesChanged(this); + } +} + +qreal Record::value(int column) const +{ + if (column >= m_values.count()) + return 0.0; + return m_values.at(column).toReal(); +} + +void Record::setValue(int column, qreal value) +{ + while(column >= m_values.count()) { + m_values.append(0.0); + } + m_values[column] = value; + emit valuesChanged(this); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kqtquickcharts-4.13.2/src/record.h new/kqtquickcharts-4.13.80/src/record.h --- old/kqtquickcharts-4.13.2/src/record.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kqtquickcharts-4.13.80/src/record.h 2014-04-10 09:51:33.000000000 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + */ + +#ifndef RECORD_H +#define RECORD_H + +#include <QObject> + +#include <QVariantList> + +class Record : public QObject +{ + Q_OBJECT + Q_PROPERTY(QVariantList values READ values WRITE setValues NOTIFY valuesChanged) +public: + explicit Record(QObject* parent = 0); + QVariantList values() const; + void setValues(const QVariantList& values); + Q_INVOKABLE qreal value(int column) const; + Q_INVOKABLE void setValue(int column, qreal value); +signals: + void valuesChanged(Record* record); +private: + QVariantList m_values; +}; + +#endif // RECORD_H -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org