aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2014-08-14 08:25:07 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2014-08-14 08:25:07 (GMT)
commit3f22c00d2343616c9caeed32f6cf41f675c859eb (patch)
tree3440cbf083a97210192fddc0fefaf00300873205
parent143e76a019ae52d57e3f448c7e3130cc53346506 (diff)
port to KF5
Changes consist mostly of: * build system * QDeclarativeItem -> QQuick(Painted)Item * KLocale -> QLocale * PlasmaCompontents -> Qt Quick Components * drop all KDE dependencies
-rw-r--r--CMakeLists.txt92
-rw-r--r--demo/dynamicdata/Chart.qml4
-rw-r--r--demo/dynamicdata/ChartTableView.qml (renamed from demo/dynamicdata/TableView.qml)6
-rw-r--r--demo/dynamicdata/ValueEdit.qml53
-rw-r--r--demo/dynamicdata/main.qml22
-rw-r--r--demo/minimal/main.qml2
-rw-r--r--src/CMakeLists.txt22
-rw-r--r--src/barchartcore.cpp4
-rw-r--r--src/barchartcore.h6
-rw-r--r--src/barchartsegment.cpp9
-rw-r--r--src/barchartsegment.h10
-rw-r--r--src/chartcore.cpp22
-rw-r--r--src/chartcore.h23
-rw-r--r--src/chartforegroundpainter.cpp8
-rw-r--r--src/chartforegroundpainter.h12
-rw-r--r--src/chartmodel.cpp12
-rw-r--r--src/chartmodel.h18
-rw-r--r--src/chartplugin.cpp4
-rw-r--r--src/chartplugin.h5
-rw-r--r--src/dimension.cpp10
-rw-r--r--src/dimension.h9
-rw-r--r--src/linechartbackgroundpainter.cpp10
-rw-r--r--src/linechartbackgroundpainter.h14
-rw-r--r--src/linechartcore.cpp4
-rw-r--r--src/linechartcore.h6
-rw-r--r--src/linechartpainter.cpp10
-rw-r--r--src/linechartpainter.h12
-rw-r--r--src/linechartpoint.cpp14
-rw-r--r--src/linechartpoint.h12
-rw-r--r--src/qml/BarChart.qml12
-rw-r--r--src/qml/Label.qml8
-rw-r--r--src/qml/LegendItem.qml10
-rw-r--r--src/qml/LineChart.qml14
-rw-r--r--src/qml/LineLabel.qml3
-rw-r--r--src/qml/qmldir5
-rw-r--r--src/record.h2
36 files changed, 291 insertions, 198 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e23b777..b6fa31c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,91 @@
-find_package(KDE4 4.10 REQUIRED)
+cmake_minimum_required(VERSION 2.8.12)
-add_subdirectory(src/)
+project(KQtQuickCharts)
+
+# Dependencies
+find_package(ECM 1.1.0 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+set(REQUIRED_QT_VERSION "5.2.0")
+set(KF5_VERSION "5.1.0") # handled by release scripts
+set(KF5_DEP_VERSION "5.1.0") # handled by release scripts
+
+find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Qml Quick Gui)
+include(KDEInstallDirs)
+include(KDEFrameworkCompilerSettings)
+include(KDECMakeSettings)
+
+#########################################################################
+
+add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
+
+#add_definitions(-Wno-deprecated)
+add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
+add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
+
+remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
+
+
+
+# Includes
+include(FeatureSummary)
+include(GenerateExportHeader)
+include(ECMSetupVersion)
+include(ECMGenerateHeaders)
+include(ECMPackageConfigHelpers)
+
+# ECM setup
+ecm_setup_version(
+ ${KF5_VERSION}
+ VARIABLE_PREFIX KQTQUICKCHARTS
+ VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kqtquickcharts_version.h"
+ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KQtQuickChartsVersion.cmake"
+ SOVERSION 1)
+
+# Subdirectories
+add_definitions(-DTRANSLATION_DOMAIN=\"kqtquickcharts5\")
+if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
+ ki18n_install(po)
+endif()
+
+#add_subdirectory(autotests)
+
+add_subdirectory(src)
+
+# if(KF5Config_FOUND AND KF5I18n_FOUND AND KF5IconThemes_FOUND AND KF5KIO_FOUND)
+# add_subdirectory(tests)
+# endif()
+
+# Create a Config.cmake and a ConfigVersion.cmake file and install them
+set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KQtQuickCharts")
+
+# ecm_configure_package_config_file(
+# "${CMAKE_CURRENT_SOURCE_DIR}/KQtQuickChartsConfig.cmake.in"
+# "${CMAKE_CURRENT_BINARY_DIR}/KQtQuickChartsConfig.cmake"
+# INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+# )
+
+install(FILES
+# "${CMAKE_CURRENT_BINARY_DIR}/KQtQuickChartsConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/KQtQuickChartsVersion.cmake"
+ DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+ COMPONENT Devel
+)
+
+# install(EXPORT
+# KQtQuickChartsTargets
+# DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+# FILE KQtQuickChartsTargets.cmake
+# NAMESPACE KF5::
+# COMPONENT Devel
+# )
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/kqtquickcharts_version.h"
+ DESTINATION "${KF5_INCLUDE_INSTALL_DIR}"
+ COMPONENT Devel
+)
+
+if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+endif()
diff --git a/demo/dynamicdata/Chart.qml b/demo/dynamicdata/Chart.qml
index e9f137c..b27442b 100644
--- a/demo/dynamicdata/Chart.qml
+++ b/demo/dynamicdata/Chart.qml
@@ -17,10 +17,10 @@
* You should have received a copy of the GNU Lesser General Public
*/
-import QtQuick 1.1
+import QtQuick 2.2
import org.kde.charts 0.1
-BarChart {
+LineChart {
id: chart
model: ChartModel {
columns: chart.dimensions.length
diff --git a/demo/dynamicdata/TableView.qml b/demo/dynamicdata/ChartTableView.qml
index 20c7fbb..b3b659b 100644
--- a/demo/dynamicdata/TableView.qml
+++ b/demo/dynamicdata/ChartTableView.qml
@@ -17,12 +17,12 @@
* You should have received a copy of the GNU Lesser General Public
*/
-import QtQuick 1.1
+import QtQuick 2.2
import org.kde.charts 0.1
Rectangle {
id: root
- property variant chart
+ property Item chart
width: chart.model.columns * (listView.cellWidth + listView.spacing) + listView.spacing
@@ -39,7 +39,7 @@ Rectangle {
clip: true
model: root.chart.model.rows
- property real cellHeight: theme.defaultFont.mSize.height * 2
+ property real cellHeight: 30
property real cellWidth: 4 * cellHeight
spacing: 3
diff --git a/demo/dynamicdata/ValueEdit.qml b/demo/dynamicdata/ValueEdit.qml
index bbc45ff..0a003eb 100644
--- a/demo/dynamicdata/ValueEdit.qml
+++ b/demo/dynamicdata/ValueEdit.qml
@@ -17,16 +17,15 @@
* 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
+import QtQuick 2.2
+import QtQuick.Controls 1.2
Rectangle {
color: "#ddd"
id: root
property real value: 0.0
property bool editing: false
- property real internalPadding: theme.defaultFont.mSize.height * 0.3
+ property real internalPadding: 3
Text {
anchors {
@@ -49,36 +48,40 @@ Rectangle {
if (loader.item) {
loader.item.forceActiveFocus()
}
+ else {
+ loader.sourceComponent = editorComponent
+ }
}
}
- PlasmaExtras.ConditionalLoader {
+ Loader {
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
- }
+ }
+
+ Component {
+ id: editorComponent
+ 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
}
- onAccepted: {
+ }
+ onActiveFocusChanged: {
+ if (!activeFocus) {
root.editing = false
}
}
+ onAccepted: {
+ root.editing = false
+ }
}
}
}
diff --git a/demo/dynamicdata/main.qml b/demo/dynamicdata/main.qml
index e4b0e07..cd43f6c 100644
--- a/demo/dynamicdata/main.qml
+++ b/demo/dynamicdata/main.qml
@@ -17,8 +17,8 @@
* 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 QtQuick 2.2
+import QtQuick.Controls 1.2
import org.kde.charts 0.1
Column {
@@ -57,25 +57,25 @@ Column {
}
}
- PlasmaComponents.ToolBar {
+ ToolBar {
id: toolbar
- tools: Row {
+ Row {
spacing: 4
- PlasmaComponents.ToolButton {
+ ToolButton {
anchors.verticalCenter: parent.verticalCenter
- iconSource: "edit-table-insert-row-below"
+ //iconSource: "edit-table-insert-row-below"
text: "Append record"
onClicked: appendRecord()
}
- PlasmaComponents.ToolButton {
+ ToolButton {
anchors.verticalCenter: parent.verticalCenter
- iconSource: "edit-table-insert-row-above"
+ //iconSource: "edit-table-insert-row-above"
text: "Insert record"
onClicked: insertRecord()
}
- PlasmaComponents.ToolButton {
+ ToolButton {
anchors.verticalCenter: parent.verticalCenter
- iconSource: "edit-table-delete-row"
+ //iconSource: "edit-table-delete-row"
text: "Remove record"
onClicked: removeRecord()
}
@@ -94,7 +94,7 @@ Column {
spacing: 40
- TableView {
+ ChartTableView {
id: tableView
height: parent.height
chart: chart
diff --git a/demo/minimal/main.qml b/demo/minimal/main.qml
index 3f4a63e..731881d 100644
--- a/demo/minimal/main.qml
+++ b/demo/minimal/main.qml
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU Lesser General Public
*/
-import QtQuick 1.1
+import QtQuick 2.2
import org.kde.charts 0.1
Rectangle {
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7168b05..d10934a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,10 +1,3 @@
-project(kqtquickcharts)
-
-include(KDE4Defaults)
-add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
-
-include_directories(${QT_INCLUDE} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
-
set(kqtquickcharts_SRCS
dimension.cpp
chartplugin.cpp
@@ -20,10 +13,17 @@ set(kqtquickcharts_SRCS
record.cpp
)
-automoc4_add_library(kqtquickcharts SHARED ${kqtquickcharts_SRCS})
-target_link_libraries(kqtquickcharts ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${KDECLARATIVE_LIBRARIES})
+add_library(kqtquickcharts SHARED ${kqtquickcharts_SRCS})
+
+
+target_link_libraries(kqtquickcharts
+ Qt5::Core
+ Qt5::Quick
+ Qt5::Qml
+ Qt5::Gui
+)
-install(TARGETS kqtquickcharts DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/charts)
+install(TARGETS kqtquickcharts DESTINATION ${QML_INSTALL_DIR}/org/kde/charts)
set(kqtquickcharts_files
qml/qmldir
@@ -35,4 +35,4 @@ set(kqtquickcharts_files
qml/Label.qml
)
-install(FILES ${kqtquickcharts_files} DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/charts)
+install(FILES ${kqtquickcharts_files} DESTINATION ${QML_INSTALL_DIR}/org/kde/charts)
diff --git a/src/barchartcore.cpp b/src/barchartcore.cpp
index ffc4613..9424eea 100644
--- a/src/barchartcore.cpp
+++ b/src/barchartcore.cpp
@@ -19,7 +19,7 @@
#include "barchartcore.h"
-BarChartCore::BarChartCore(QDeclarativeItem* parent) :
+BarChartCore::BarChartCore(QQuickItem* parent) :
ChartCore(parent)
{
connect(this, SIGNAL(pitchChanged()), SIGNAL(barWidthChanged()));
@@ -30,7 +30,7 @@ qreal BarChartCore::barWidth() const
return qRound(pitch() / (dimensionsList().length() + 1));
}
-void BarChartCore::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
+void BarChartCore::paint(QPainter* painter)
{
paintAxisAndLines(painter, 0.0);
}
diff --git a/src/barchartcore.h b/src/barchartcore.h
index fdee9b3..d080102 100644
--- a/src/barchartcore.h
+++ b/src/barchartcore.h
@@ -27,10 +27,10 @@ class BarChartCore : public ChartCore
Q_OBJECT
Q_PROPERTY(qreal barWidth READ barWidth NOTIFY barWidthChanged)
public:
- explicit BarChartCore(QDeclarativeItem* parent = 0);
+ explicit BarChartCore(QQuickItem* parent = 0);
qreal barWidth() const;
- void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
-signals:
+ void paint(QPainter* painter);
+Q_SIGNALS:
void barWidthChanged();
};
diff --git a/src/barchartsegment.cpp b/src/barchartsegment.cpp
index bebc1a7..f1b5d3b 100644
--- a/src/barchartsegment.cpp
+++ b/src/barchartsegment.cpp
@@ -24,10 +24,8 @@
#include "dimension.h"
#include "barchartcore.h"
-#include <KDebug>
-
-BarChartSegment::BarChartSegment(QDeclarativeItem* parent) :
- QDeclarativeItem(parent),
+BarChartSegment::BarChartSegment(QQuickItem* parent) :
+ QQuickItem(parent),
m_barChartCore(0),
m_dimension(-1),
m_row(-1)
@@ -108,6 +106,9 @@ qreal BarChartSegment::barHeight() const
QString BarChartSegment::text() const
{
+ if (!m_barChartCore)
+ return QString();
+
const int role = m_barChartCore->textRole();
if (role == -1)
diff --git a/src/barchartsegment.h b/src/barchartsegment.h
index 83adb7e..2e4ecf3 100644
--- a/src/barchartsegment.h
+++ b/src/barchartsegment.h
@@ -20,11 +20,11 @@
#ifndef BARGRAPHSEGMENT_H
#define BARGRAPHSEGMENT_H
-#include <QDeclarativeItem>
+#include <QQuickItem>
class BarChartCore;
-class BarChartSegment : public QDeclarativeItem
+class BarChartSegment : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(BarChartCore* barChartCore READ barChartCore WRITE setBarChartCore NOTIFY barChartCoreChanged)
@@ -33,7 +33,7 @@ class BarChartSegment : public QDeclarativeItem
Q_PROPERTY(qreal barHeight READ barHeight NOTIFY barHeightChanged)
Q_PROPERTY(QString text READ text NOTIFY textChanged)
public:
- explicit BarChartSegment(QDeclarativeItem* parent = 0);
+ explicit BarChartSegment(QQuickItem* parent = 0);
BarChartCore* barChartCore() const;
void setBarChartCore(BarChartCore* barChartCore);
int dimension() const;
@@ -42,13 +42,13 @@ public:
void setRow(int row);
qreal barHeight() const;
QString text() const;
-signals:
+Q_SIGNALS:
void barChartCoreChanged();
void dimensionChanged();
void rowChanged();
void barHeightChanged();
void textChanged();
-private slots:
+private Q_SLOTS:
void triggerUpdate();
private:
bool valid() const;
diff --git a/src/chartcore.cpp b/src/chartcore.cpp
index 78a6ca0..b5c9865 100644
--- a/src/chartcore.cpp
+++ b/src/chartcore.cpp
@@ -22,13 +22,13 @@
#include <QAbstractTableModel>
#include <QPainter>
-ChartCore::ChartCore(QDeclarativeItem *parent) :
- QDeclarativeItem(parent),
+ChartCore::ChartCore(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
m_model(0),
m_pitch(50.0),
m_textRole(-1)
{
- setFlag(QGraphicsItem::ItemHasNoContents, false);
+ setFlag(QQuickItem::ItemHasContents, true);
}
QAbstractTableModel* ChartCore::model() const
@@ -62,8 +62,8 @@ void ChartCore::setModel(QAbstractTableModel* model)
}
}
-QDeclarativeListProperty<Dimension> ChartCore::dimensions() {
- return QDeclarativeListProperty<Dimension>(this, 0, &ChartCore::appendDimension, &ChartCore::countDimensions, &ChartCore::dimensionAt, &ChartCore::clearDimensions);
+QQmlListProperty<Dimension> ChartCore::dimensions() {
+ return QQmlListProperty<Dimension>(this, 0, &ChartCore::appendDimension, &ChartCore::countDimensions, &ChartCore::dimensionAt, &ChartCore::clearDimensions);
}
QList<Dimension*> ChartCore::dimensionsList() const
@@ -109,6 +109,10 @@ void ChartCore::triggerUpdate()
update();
}
+void ChartCore::paint(QPainter*)
+{
+}
+
void ChartCore::paintAxisAndLines(QPainter* painter, qreal offset)
{
const int minY = qRound(offset);
@@ -130,7 +134,7 @@ void ChartCore::paintAxisAndLines(QPainter* painter, qreal offset)
painter->drawRect(QRectF(QPointF(x1, maxY), QPointF(x2, maxY + 1)));
}
-void ChartCore::appendDimension(QDeclarativeListProperty<Dimension>* list, Dimension *dimension) {
+void ChartCore::appendDimension(QQmlListProperty<Dimension>* list, Dimension *dimension) {
ChartCore* chartCore = qobject_cast<ChartCore*>(list->object);
if (chartCore) {
dimension->setParent(chartCore);
@@ -140,7 +144,7 @@ void ChartCore::appendDimension(QDeclarativeListProperty<Dimension>* list, Dimen
}
}
-int ChartCore::countDimensions(QDeclarativeListProperty<Dimension>* list) {
+int ChartCore::countDimensions(QQmlListProperty<Dimension>* list) {
ChartCore* chartCore = qobject_cast<ChartCore*>(list->object);
if (chartCore) {
return chartCore->m_dimensions.count();
@@ -148,7 +152,7 @@ int ChartCore::countDimensions(QDeclarativeListProperty<Dimension>* list) {
return -1;
}
-Dimension* ChartCore::dimensionAt(QDeclarativeListProperty<Dimension>* list, int index) {
+Dimension* ChartCore::dimensionAt(QQmlListProperty<Dimension>* list, int index) {
ChartCore* chartCore = qobject_cast<ChartCore*>(list->object);
if (chartCore) {
return chartCore->m_dimensions.at(index);
@@ -156,7 +160,7 @@ Dimension* ChartCore::dimensionAt(QDeclarativeListProperty<Dimension>* list, int
return 0;
}
-void ChartCore::clearDimensions(QDeclarativeListProperty<Dimension>* list) {
+void ChartCore::clearDimensions(QQmlListProperty<Dimension>* list) {
ChartCore* chartCore = qobject_cast<ChartCore*>(list->object);
if (chartCore) {
foreach (Dimension* dimension, chartCore->m_dimensions)
diff --git a/src/chartcore.h b/src/chartcore.h
index f792da7..8923e46 100644
--- a/src/chartcore.h
+++ b/src/chartcore.h
@@ -20,44 +20,45 @@
#ifndef GRAPHCORE_H
#define GRAPHCORE_H
-#include <QDeclarativeItem>
+#include <QQuickPaintedItem>
#include "dimension.h"
class QAbstractTableModel;
-class ChartCore : public QDeclarativeItem
+class ChartCore : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(QAbstractTableModel* model READ model WRITE setModel NOTIFY modelChanged)
- Q_PROPERTY(QDeclarativeListProperty<Dimension> dimensions READ dimensions CONSTANT)
+ Q_PROPERTY(QQmlListProperty<Dimension> dimensions READ dimensions CONSTANT)
Q_PROPERTY(qreal pitch READ pitch WRITE setPitch NOTIFY pitchChanged)
Q_PROPERTY(int textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged)
public:
- explicit ChartCore(QDeclarativeItem *parent = 0);
+ explicit ChartCore(QQuickItem *parent = 0);
QAbstractTableModel* model() const;
void setModel(QAbstractTableModel* model);
- QDeclarativeListProperty<Dimension> dimensions();
+ QQmlListProperty<Dimension> dimensions();
QList<Dimension*> dimensionsList() const;
qreal pitch() const;
void setPitch(qreal pitch);
int textRole() const;
void setTextRole(int textRole);
-signals:
+Q_SIGNALS:
void modelChanged();
void chartStyleChanged();
void pitchChanged();
void textRoleChanged();
void updated();
-protected slots:
+protected Q_SLOTS:
void triggerUpdate();
protected:
+ void paint(QPainter* painter);
void paintAxisAndLines(QPainter* painter, qreal offset);
private:
- static void appendDimension(QDeclarativeListProperty<Dimension>* list, Dimension* dimension);
- static int countDimensions(QDeclarativeListProperty<Dimension>* list);
- static Dimension* dimensionAt(QDeclarativeListProperty<Dimension>* list, int index);
- static void clearDimensions(QDeclarativeListProperty<Dimension>* list);
+ static void appendDimension(QQmlListProperty<Dimension>* list, Dimension* dimension);
+ static int countDimensions(QQmlListProperty<Dimension>* list);
+ static Dimension* dimensionAt(QQmlListProperty<Dimension>* list, int index);
+ static void clearDimensions(QQmlListProperty<Dimension>* list);
QAbstractTableModel* m_model;
QList<Dimension*> m_dimensions;
qreal m_pitch;
diff --git a/src/chartforegroundpainter.cpp b/src/chartforegroundpainter.cpp
index 590d3ca..a7c7153 100644
--- a/src/chartforegroundpainter.cpp
+++ b/src/chartforegroundpainter.cpp
@@ -23,11 +23,11 @@
#include "chartcore.h"
-ChartForegroundPainter::ChartForegroundPainter(QDeclarativeItem *parent) :
- QDeclarativeItem(parent),
+ChartForegroundPainter::ChartForegroundPainter(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
m_chartCore(0)
{
- setFlag(QGraphicsItem::ItemHasNoContents, false);
+ setFlag(QQuickItem::ItemHasContents, true);
}
ChartCore* ChartForegroundPainter::chartCore() const
@@ -71,7 +71,7 @@ void ChartForegroundPainter::setBackgroundColor(const QColor& backgroundColor)
}
}
-void ChartForegroundPainter::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
+void ChartForegroundPainter::paint(QPainter* painter)
{
if (!m_chartCore)
return;
diff --git a/src/chartforegroundpainter.h b/src/chartforegroundpainter.h
index 344cd2c..75ec8f1 100644
--- a/src/chartforegroundpainter.h
+++ b/src/chartforegroundpainter.h
@@ -20,26 +20,26 @@
#ifndef LINEGRAPHFOREGROUNDPAINTER_H
#define LINEGRAPHFOREGROUNDPAINTER_H
-#include <QDeclarativeItem>
+#include <QQuickPaintedItem>
class ChartCore;
-class ChartForegroundPainter : public QDeclarativeItem
+class ChartForegroundPainter : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(ChartCore* chartCore READ chartCore WRITE setChartCore NOTIFY chartCoreChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
public:
- explicit ChartForegroundPainter(QDeclarativeItem* parent = 0);
+ explicit ChartForegroundPainter(QQuickItem* parent = 0);
ChartCore* chartCore() const;
void setChartCore(ChartCore* chartCore);
QColor backgroundColor() const;
void setBackgroundColor(const QColor& backgroundColor);
- void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
-signals:
+ void paint(QPainter* painter);
+Q_SIGNALS:
void chartCoreChanged();
void backgroundColorChanged();
-private slots:
+private Q_SLOTS:
void triggerUpdate();
private:
ChartCore* m_chartCore;
diff --git a/src/chartmodel.cpp b/src/chartmodel.cpp
index 4c7b6e9..350962c 100644
--- a/src/chartmodel.cpp
+++ b/src/chartmodel.cpp
@@ -27,9 +27,9 @@ ChartModel::ChartModel(QObject* parent) :
{
}
-QDeclarativeListProperty<Record> ChartModel::records()
+QQmlListProperty<Record> ChartModel::records()
{
- return QDeclarativeListProperty<Record>(this, 0, &ChartModel::appendRecord, &ChartModel::countRecords, &ChartModel::recordAt, &ChartModel::clearRecords);
+ return QQmlListProperty<Record>(this, 0, &ChartModel::appendRecord, &ChartModel::countRecords, &ChartModel::recordAt, &ChartModel::clearRecords);
}
int ChartModel::columns() const
@@ -129,7 +129,7 @@ void ChartModel::insertRecord(int row, Record *record)
emit rowsChanged();
}
-void ChartModel::appendRecord(QDeclarativeListProperty<Record>* list, Record* record)
+void ChartModel::appendRecord(QQmlListProperty<Record>* list, Record* record)
{
ChartModel* chartModel = qobject_cast<ChartModel*>(list->object);
if (chartModel)
@@ -138,7 +138,7 @@ void ChartModel::appendRecord(QDeclarativeListProperty<Record>* list, Record* re
}
}
-int ChartModel::countRecords(QDeclarativeListProperty<Record>* list)
+int ChartModel::countRecords(QQmlListProperty<Record>* list)
{
ChartModel* chartModel = qobject_cast<ChartModel*>(list->object);
if (chartModel)
@@ -148,7 +148,7 @@ int ChartModel::countRecords(QDeclarativeListProperty<Record>* list)
return -1;
}
-Record* ChartModel::recordAt(QDeclarativeListProperty<Record>* list, int index)
+Record* ChartModel::recordAt(QQmlListProperty<Record>* list, int index)
{
ChartModel* chartModel = qobject_cast<ChartModel*>(list->object);
if (chartModel)
@@ -158,7 +158,7 @@ Record* ChartModel::recordAt(QDeclarativeListProperty<Record>* list, int index)
return 0;
}
-void ChartModel::clearRecords(QDeclarativeListProperty<Record>* list)
+void ChartModel::clearRecords(QQmlListProperty<Record>* list)
{
ChartModel* chartModel = qobject_cast<ChartModel*>(list->object);
if (chartModel)
diff --git a/src/chartmodel.h b/src/chartmodel.h
index 1d3373d..57bc1b6 100644
--- a/src/chartmodel.h
+++ b/src/chartmodel.h
@@ -22,19 +22,19 @@
#include <QAbstractTableModel>
-#include <QDeclarativeListProperty>
+#include <QQmlListProperty>
class Record;
class ChartModel : public QAbstractTableModel
{
Q_OBJECT
- Q_PROPERTY(QDeclarativeListProperty<Record> records READ records CONSTANT)
+ Q_PROPERTY(QQmlListProperty<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();
+ QQmlListProperty<Record> records();
int columns() const;
void setColumns(int columns);
int rows() const;
@@ -47,18 +47,18 @@ public:
int rowCount(const QModelIndex& parent) const;
int columnCount(const QModelIndex& parent) const;
QVariant data(const QModelIndex& index, int role) const;
-signals:
+Q_SIGNALS:
void columnsChanged();
void rowsChanged();
void recordChanged(int row);
-private slots:
+private Q_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);
+ static void appendRecord(QQmlListProperty<Record>* list, Record* record);
+ static int countRecords(QQmlListProperty<Record>* list);
+ static Record* recordAt(QQmlListProperty<Record>* list, int index);
+ static void clearRecords(QQmlListProperty<Record>* list);
QList<Record*> m_records;
int m_columns;
};
diff --git a/src/chartplugin.cpp b/src/chartplugin.cpp
index b3d7813..fde031c 100644
--- a/src/chartplugin.cpp
+++ b/src/chartplugin.cpp
@@ -19,7 +19,7 @@
#include "chartplugin.h"
-#include <qdeclarative.h>
+#include <QQmlEngine>
#include <QAbstractTableModel>
#include "barchartcore.h"
@@ -52,5 +52,3 @@ void ChartPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<QAbstractTableModel>(uri, 0, 1, "QAbstractTableModel", "abstract class");
}
-
-Q_EXPORT_PLUGIN2(chartplugin, ChartPlugin)
diff --git a/src/chartplugin.h b/src/chartplugin.h
index 5dd7099..61ae712 100644
--- a/src/chartplugin.h
+++ b/src/chartplugin.h
@@ -20,11 +20,12 @@
#ifndef GRAPHPLUGIN_H
#define GRAPHPLUGIN_H
-#include <QDeclarativeExtensionPlugin>
+#include <QQmlExtensionPlugin>
-class ChartPlugin : public QDeclarativeExtensionPlugin
+class ChartPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri);
};
diff --git a/src/dimension.cpp b/src/dimension.cpp
index 13f2138..946ce04 100644
--- a/src/dimension.cpp
+++ b/src/dimension.cpp
@@ -19,11 +19,10 @@
#include "dimension.h"
-#include <KGlobal>
-#include <KLocale>
+#include <QLocale>
-Dimension::Dimension(QDeclarativeItem* parent) :
- QDeclarativeItem(parent),
+Dimension::Dimension(QObject* parent) :
+ QObject(parent),
m_color(Qt::black),
m_dataColumn(0),
m_minimumValue(0),
@@ -155,5 +154,6 @@ void Dimension::setUnitFactor(qreal unitFactor)
QString Dimension::formatValue(qreal value)
{
- return KGlobal::locale()->formatNumber(value * m_unitFactor, m_precision) + m_unit;
+ QLocale locale;
+ return locale.toString(value * m_unitFactor, 'f', m_precision);
}
diff --git a/src/dimension.h b/src/dimension.h
index da0d2c3..740aecf 100644
--- a/src/dimension.h
+++ b/src/dimension.h
@@ -20,12 +20,11 @@
#ifndef DIMENSION_H
#define DIMENSION_H
-#include <QDeclarativeItem>
+#include <QObject>
#include <QColor>
-#include <QDeclarativeListProperty>
-class Dimension : public QDeclarativeItem
+class Dimension : public QObject
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
@@ -38,7 +37,7 @@ class Dimension : public QDeclarativeItem
Q_PROPERTY(qreal unitFactor READ unitFactor WRITE setUnitFactor NOTIFY unitFactorChanged)
public:
- explicit Dimension(QDeclarativeItem* parent = 0);
+ explicit Dimension(QObject* parent = 0);
QColor color() const;
void setColor(const QColor& color);
int dataColumn() const;
@@ -56,7 +55,7 @@ public:
qreal unitFactor() const;
void setUnitFactor(qreal unitFactor);
Q_INVOKABLE QString formatValue(qreal value);
-signals:
+Q_SIGNALS:
void colorChanged();
void dataColumnChanged();
void minimumValueChanged();
diff --git a/src/linechartbackgroundpainter.cpp b/src/linechartbackgroundpainter.cpp
index 0a2e148..02994ac 100644
--- a/src/linechartbackgroundpainter.cpp
+++ b/src/linechartbackgroundpainter.cpp
@@ -25,13 +25,11 @@
#include "linechartcore.h"
#include "dimension.h"
-#include <KDebug>
-
-LineChartBackgroundPainter::LineChartBackgroundPainter(QDeclarativeItem* parent) :
- QDeclarativeItem(parent),
+LineChartBackgroundPainter::LineChartBackgroundPainter(QQuickItem* parent) :
+ QQuickPaintedItem(parent),
m_lineChartCore(0)
{
- setFlag(QGraphicsItem::ItemHasNoContents, false);
+ setFlag(QQuickItem::ItemHasContents, true);
connect(this, SIGNAL(heightChanged()), SLOT(triggerUpdate()));
}
@@ -67,7 +65,7 @@ const QList<QPolygonF>& LineChartBackgroundPainter::linePolygons() const
return m_linePolygons;
}
-void LineChartBackgroundPainter::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
+void LineChartBackgroundPainter::paint(QPainter* painter)
{
if (m_lineChartCore->model()->rowCount() == 0)
return;
diff --git a/src/linechartbackgroundpainter.h b/src/linechartbackgroundpainter.h
index adadd48..5cef06b 100644
--- a/src/linechartbackgroundpainter.h
+++ b/src/linechartbackgroundpainter.h
@@ -20,24 +20,26 @@
#ifndef LINEGRAPHBACKGROUNDPAINTER_H
#define LINEGRAPHBACKGROUNDPAINTER_H
-#include <QDeclarativeItem>
+#include <QQuickPaintedItem>
+
+#include <QPolygonF>
class LineChartCore;
-class LineChartBackgroundPainter : public QDeclarativeItem
+class LineChartBackgroundPainter : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(LineChartCore* lineChartCore READ lineChartCore WRITE setLineChartCore NOTIFY lineChartCoreChanged)
public:
- explicit LineChartBackgroundPainter(QDeclarativeItem* parent = 0);
+ explicit LineChartBackgroundPainter(QQuickItem* parent = 0);
LineChartCore* lineChartCore() const;
void setLineChartCore(LineChartCore* lineChartCore);
- void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
+ void paint(QPainter* painter);
const QList<QPolygonF>& linePolygons() const;
-signals:
+Q_SIGNALS:
void lineChartCoreChanged();
void linePolygonsUpdated();
-private slots:
+private Q_SLOTS:
void triggerUpdate();
private:
void updateWidth();
diff --git a/src/linechartcore.cpp b/src/linechartcore.cpp
index 886c3b1..1308c0d 100644
--- a/src/linechartcore.cpp
+++ b/src/linechartcore.cpp
@@ -19,7 +19,7 @@
#include "linechartcore.h"
-LineChartCore::LineChartCore(QDeclarativeItem* parent) :
+LineChartCore::LineChartCore(QQuickItem* parent) :
ChartCore(parent),
m_pointRadius(5.0)
{
@@ -40,7 +40,7 @@ void LineChartCore::setPointRadius(qreal pointRadius)
}
}
-void LineChartCore::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
+void LineChartCore::paint(QPainter* painter)
{
paintAxisAndLines(painter, m_pointRadius);
}
diff --git a/src/linechartcore.h b/src/linechartcore.h
index 4d99ede..546c4c5 100644
--- a/src/linechartcore.h
+++ b/src/linechartcore.h
@@ -27,11 +27,11 @@ class LineChartCore : public ChartCore
Q_OBJECT
Q_PROPERTY(qreal pointRadius READ pointRadius WRITE setPointRadius NOTIFY pointRadiusChanged)
public:
- explicit LineChartCore(QDeclarativeItem* parent = 0);
+ explicit LineChartCore(QQuickItem* parent = 0);
qreal pointRadius() const;
void setPointRadius(qreal pointRadius);
- void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
-signals:
+ void paint(QPainter* painter);
+Q_SIGNALS:
void pointRadiusChanged();
private:
qreal m_pointRadius;
diff --git a/src/linechartpainter.cpp b/src/linechartpainter.cpp
index 1912fc1..922fa41 100644
--- a/src/linechartpainter.cpp
+++ b/src/linechartpainter.cpp
@@ -25,15 +25,13 @@
#include "dimension.h"
#include "linechartbackgroundpainter.h"
-#include <KDebug>
-
-LineChartPainter::LineChartPainter(QDeclarativeItem* parent) :
- QDeclarativeItem(parent),
+LineChartPainter::LineChartPainter(QQuickItem* parent) :
+ QQuickPaintedItem(parent),
m_lineChartCore(0),
m_backgroundPainter(0),
m_dimension(-1)
{
- setFlag(QGraphicsItem::ItemHasNoContents, false);
+ setFlag(QQuickItem::ItemHasContents, true);
}
LineChartCore* LineChartPainter::lineChartCore() const
@@ -92,7 +90,7 @@ void LineChartPainter::setDimension(int dimension)
}
}
-void LineChartPainter::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
+void LineChartPainter::paint(QPainter* painter)
{
if (!m_lineChartCore || !m_backgroundPainter || m_dimension == -1)
return;
diff --git a/src/linechartpainter.h b/src/linechartpainter.h
index 7fed82c..3222f1b 100644
--- a/src/linechartpainter.h
+++ b/src/linechartpainter.h
@@ -19,31 +19,31 @@
#ifndef LINEGRAPHPAINTER_H
#define LINEGRAPHPAINTER_H
-#include <QDeclarativeItem>
+#include <QQuickPaintedItem>
class LineChartCore;
class LineChartBackgroundPainter;
-class LineChartPainter : public QDeclarativeItem
+class LineChartPainter : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(LineChartCore* lineChartCore READ lineChartCore WRITE setLineChartCore NOTIFY lineChartCoreChanged)
Q_PROPERTY(LineChartBackgroundPainter* backgroundPainter READ backgroundPainter WRITE setBackgroundPainter NOTIFY backgroundPainterChanged)
Q_PROPERTY(int dimension READ dimension WRITE setDimension NOTIFY dimensionChanged)
public:
- explicit LineChartPainter(QDeclarativeItem* parent = 0);
+ explicit LineChartPainter(QQuickItem* parent = 0);
LineChartCore* lineChartCore() const;
void setLineChartCore(LineChartCore* lineChartCore);
LineChartBackgroundPainter* backgroundPainter() const;
void setBackgroundPainter(LineChartBackgroundPainter* backgroundPainter);
int dimension() const;
void setDimension(int dimension);
- void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
-signals:
+ void paint(QPainter* painter);
+Q_SIGNALS:
void lineChartCoreChanged();
void backgroundPainterChanged();
void dimensionChanged();
-private slots:
+private Q_SLOTS:
void triggerUpdate();
private:
void updateWidth();
diff --git a/src/linechartpoint.cpp b/src/linechartpoint.cpp
index 80591d3..562ad4e 100644
--- a/src/linechartpoint.cpp
+++ b/src/linechartpoint.cpp
@@ -26,14 +26,14 @@
#include "dimension.h"
#include "linechartbackgroundpainter.h"
-LineChartPoint::LineChartPoint(QDeclarativeItem* parent) :
- QDeclarativeItem(parent),
+LineChartPoint::LineChartPoint(QQuickItem* parent) :
+ QQuickPaintedItem(parent),
m_lineChartCore(0),
m_backgroundPainter(0),
m_dimension(-1),
m_row(-1)
{
- setFlag(QGraphicsItem::ItemHasNoContents, false);
+ setFlag(QQuickItem::ItemHasContents, true);
}
LineChartCore* LineChartPoint::lineChartCore() const
@@ -120,6 +120,9 @@ void LineChartPoint::setRow(int row)
QString LineChartPoint::text() const
{
+ if (!m_lineChartCore)
+ return QString();
+
const int role = m_lineChartCore->textRole();
if (role == -1)
@@ -132,7 +135,7 @@ QString LineChartPoint::text() const
return model->data(model->index(m_row, column), role).toString();
}
-void LineChartPoint::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
+void LineChartPoint::paint(QPainter* painter)
{
if (!valid())
return;
@@ -161,7 +164,8 @@ void LineChartPoint::updateGeometry()
setHeight(2 * radius);
QPointF center = m_backgroundPainter->linePolygons().at(m_dimension).at(m_row);
- setPos(center - QPointF(radius, radius));
+ setX(center.x() - radius);
+ setY(center.y() - radius);
}
bool LineChartPoint::valid() const
diff --git a/src/linechartpoint.h b/src/linechartpoint.h
index ddde219..0a54a24 100644
--- a/src/linechartpoint.h
+++ b/src/linechartpoint.h
@@ -20,12 +20,12 @@
#ifndef LINEGRAPHPOINT_H
#define LINEGRAPHPOINT_H
-#include <QDeclarativeItem>
+#include <QQuickPaintedItem>
class LineChartCore;
class LineChartBackgroundPainter;
-class LineChartPoint : public QDeclarativeItem
+class LineChartPoint : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(LineChartCore* lineChartCore READ lineChartCore WRITE setLineChartCore NOTIFY lineChartCoreChanged)
@@ -34,7 +34,7 @@ class LineChartPoint : public QDeclarativeItem
Q_PROPERTY(int row READ row WRITE setRow NOTIFY rowChanged)
Q_PROPERTY(QString text READ text NOTIFY textChanged)
public:
- explicit LineChartPoint(QDeclarativeItem* parent = 0);
+ explicit LineChartPoint(QQuickItem* parent = 0);
LineChartCore* lineChartCore() const;
void setLineChartCore(LineChartCore* lineChartCore);
LineChartBackgroundPainter* backgroundPainter() const;
@@ -44,15 +44,15 @@ public:
int row() const;
void setRow(int row);
QString text() const;
- void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
-signals:
+ void paint(QPainter* painter);
+Q_SIGNALS:
void lineChartCoreChanged();
void backgroundPainterChanged();
void dimensionChanged();
void rowChanged();
void textChanged();
void maxYChanged();
-private slots:
+private Q_SLOTS:
void triggerUpdate();
private:
void updateGeometry();
diff --git a/src/qml/BarChart.qml b/src/qml/BarChart.qml
index 29ef6b8..4039d8d 100644
--- a/src/qml/BarChart.qml
+++ b/src/qml/BarChart.qml
@@ -17,8 +17,8 @@
* 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 QtQuick 2.2
+import org.kde.charts 0.1
/**
* An interactive bar chart.
@@ -74,7 +74,7 @@ Item {
* @warn colors with an non-zero alpha component aren't supported yet
* and result in an visual defiencies.
*
- * Default value is the theme's background color.
+ * Default value is white.
*/
property alias backgroundColor: bg.color
@@ -84,9 +84,9 @@ Item {
*
* Used for pitch line and date element labels.
*
- * Default value is the theme's text color.
+ * Default value is black.
*/
- property color textColor: theme.textColor
+ property color textColor: "#000"
/**
* The amount of space between the outline of the chart background
@@ -126,7 +126,7 @@ Item {
Rectangle {
id: bg
anchors.fill: parent
- color: theme.backgroundColor
+ color: "#fff"
}
BarChartCore {
diff --git a/src/qml/Label.qml b/src/qml/Label.qml
index 7702aac..4ee1856 100644
--- a/src/qml/Label.qml
+++ b/src/qml/Label.qml
@@ -17,13 +17,11 @@
* 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 QtQuick 2.2
+import org.kde.charts 0.1
-PlasmaComponents.Label {
+Text {
property Rectangle backgroundItem
- height: paintedHeight
- font.pointSize: theme.smallestFont.pointSize
style: Text.Outline;
styleColor: backgroundItem.color
}
diff --git a/src/qml/LegendItem.qml b/src/qml/LegendItem.qml
index 0e1d9f4..5ca724b 100644
--- a/src/qml/LegendItem.qml
+++ b/src/qml/LegendItem.qml
@@ -17,9 +17,8 @@
* 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 QtQuick 2.0
+import org.kde.charts 0.1
/**
* An item to compose the legend for a chart of.
@@ -35,7 +34,7 @@ Item {
/**
* The text color for the legend label.
*
- * Default value is the theme's text color
+ * Default value is black.
*/
property alias textColor: label.color
@@ -54,13 +53,12 @@ Item {
radius: 4
}
- PlasmaComponents.Label {
+ Text {
id: label
anchors {
top: parent.top
right: parent.right
}
text: dimension.label
- height: paintedHeight
}
}
diff --git a/src/qml/LineChart.qml b/src/qml/LineChart.qml
index 7228d93..90d87db 100644
--- a/src/qml/LineChart.qml
+++ b/src/qml/LineChart.qml
@@ -17,8 +17,8 @@
* 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 QtQuick 2.2
+import org.kde.charts 0.1
/**
* An interactive line chart.
@@ -74,7 +74,7 @@ Item {
* @warn colors with an non-zero alpha component aren't supported yet
* and result in an visual defiencies.
*
- * Default value is the theme's background color.
+ * Default value is white.
*/
property alias backgroundColor: bg.color
@@ -82,11 +82,11 @@ Item {
* type:color
* The text color used for the chart
*
- * Used for pitch line and date element labels.
+ * Used for pitch lines and date element labels.
*
- * Default value is the theme's text color.
+ * Default value is black.
*/
- property color textColor: theme.textColor
+ property color textColor: "#000"
/**
* The amount of space between the outline of the chart background
@@ -129,7 +129,7 @@ Item {
Rectangle {
id: bg
anchors.fill: parent
- color: theme.backgroundColor
+ color: "#fff"
}
LineChartCore {
diff --git a/src/qml/LineLabel.qml b/src/qml/LineLabel.qml
index e61be64..52216eb 100644
--- a/src/qml/LineLabel.qml
+++ b/src/qml/LineLabel.qml
@@ -17,7 +17,8 @@
* You should have received a copy of the GNU Lesser General Public
*/
-import QtQuick 1.1
+import QtQuick 2.2
+import org.kde.charts 0.1
Label {
property Dimension dimension
diff --git a/src/qml/qmldir b/src/qml/qmldir
index 9bd1c6c..d36248b 100644
--- a/src/qml/qmldir
+++ b/src/qml/qmldir
@@ -1,6 +1,5 @@
-plugin kqtquickcharts
-
+module org.kde.charts
BarChart 0.1 BarChart.qml
LineChart 0.1 LineChart.qml
LegendItem 0.1 LegendItem.qml
-
+plugin kqtquickcharts
diff --git a/src/record.h b/src/record.h
index a6cfd44..5589f65 100644
--- a/src/record.h
+++ b/src/record.h
@@ -34,7 +34,7 @@ public:
void setValues(const QVariantList& values);
Q_INVOKABLE qreal value(int column) const;
Q_INVOKABLE void setValue(int column, qreal value);
-signals:
+Q_SIGNALS:
void valuesChanged(Record* record);
private:
QVariantList m_values;