From 55a228c7bf789b31f900f8339c347838ffb0fd73 Mon Sep 17 00:00:00 2001 From: Thomas Michel Date: Sun, 3 May 2015 23:41:19 +0200 Subject: [PATCH 1/2] Added buying / selling price and buying date to car class --- car.cpp | 314 +++++++++++++++++++++++++++++++-------- car.h | 44 ++++-- qml/pages/BudgetView.qml | 88 ++++++++++- qml/pages/Settings.qml | 69 ++++++++- 4 files changed, 431 insertions(+), 84 deletions(-) diff --git a/car.cpp b/car.cpp index 5917127..6bc6ffe 100644 --- a/car.cpp +++ b/car.cpp @@ -317,7 +317,7 @@ Car::Car(CarManager *parent) : QObject(parent), _manager(parent) } -Car::Car(QString name, CarManager *parent) : QObject(parent), _manager(parent), _name(name), _nbtire(0) +Car::Car(QString name, CarManager *parent) : QObject(parent), _manager(parent), _name(name), _nbtire(0),_buyingprice(0),_sellingprice(0),_lifetime(0) { this->db_init(); while(this->db_get_version() < DB_VERSION) @@ -347,6 +347,9 @@ Car::Car(QString name, CarManager *parent) : QObject(parent), _manager(parent), this->_costtypelist.append(new Costtype); qSort(_costtypelist.begin(), _costtypelist.end(), sortCosttypeById); nbtire(); + buyingprice(); + sellingprice(); + lifetime(); } unsigned int Car::nbtank() const @@ -542,16 +545,6 @@ unsigned long int Car::getDistance(QDate date) return dist; } -double Car::budget_fuel_total() -{ - double total = 0; - foreach (Tank *tank, _tanklist) - { - total += tank->price(); - } - return total; -} - double Car::budget_fuel_byType(unsigned int id) { // Returns average price of fuel type per 100Km @@ -583,33 +576,6 @@ double Car::budget_fuel_total_byType(unsigned int id) } return total; } -double Car::budget_fuel() -{ - /* Return sum(fuel price) / ODO * 100 */ - unsigned long int maxDistance = 0; - unsigned long int minDistance = 999999999; - double totalPrice = 0; - - foreach(Tank *tank, _tanklist) - { - if(tank->distance() > maxDistance) - maxDistance = tank->distance(); - if(tank->distance() < minDistance) - minDistance = tank->distance(); - totalPrice += tank->price(); - } - foreach(Tank *tank, _tanklist) - { - if(tank->distance() == minDistance) - { - totalPrice -= tank->price(); - break; - } - } - if(maxDistance == 0) return 0; - return totalPrice / ((maxDistance - minDistance)/ 100.0); -} - double Car::budget_consumption_byType(unsigned int id) { /* Return sum(fuel price) / ODO * 100 for fueltype */ @@ -645,7 +611,6 @@ double Car::budget_consumption_byType(unsigned int id) } return (totalDistance==0) ? 0.0 : (totalQuantity / totalDistance * 100.0); } - double Car::budget_consumption_max_byType(unsigned int type) { double con=0; @@ -656,7 +621,6 @@ double Car::budget_consumption_max_byType(unsigned int type) } return con; } - double Car::budget_consumption_min_byType(unsigned int type) { double con=99999; @@ -667,18 +631,6 @@ double Car::budget_consumption_min_byType(unsigned int type) } return (con==99999) ? 0 : con; } - - -double Car::budget_cost_total() -{ - double total=0; - foreach(Cost *cost,_costlist) - { - total += cost->cost(); - } - return total; -} - double Car::budget_cost_total_byType(unsigned int id) { double total=0; @@ -689,13 +641,6 @@ double Car::budget_cost_total_byType(unsigned int id) } return total; } - -double Car::budget_cost() -{ - /* Return sum(cost) / ODO * 100 */ - return budget_cost_total() / ((maxdistance() - mindistance())/ 100.0); -} - double Car::budget_cost_byType(unsigned int id) { /* Return sum(cost) / ODO * 100 */ @@ -708,16 +653,93 @@ double Car::budget_cost_byType(unsigned int id) } return totalPrice / ((maxdistance() - mindistance())/ 100.0); } - -double Car::budget_tire() +double Car::budget_fuel_total() +{ + double total = 0; + foreach (Tank *tank, _tanklist) + { + total += tank->price(); + } + return total; +} +double Car::budget_fuel() { + /* Return sum(fuel price) / ODO * 100 */ + unsigned long int maxDistance = 0; + unsigned long int minDistance = 999999999; double totalPrice = 0; + foreach(Tank *tank, _tanklist) + { + if(tank->distance() > maxDistance) + maxDistance = tank->distance(); + if(tank->distance() < minDistance) + minDistance = tank->distance(); + totalPrice += tank->price(); + } + foreach(Tank *tank, _tanklist) + { + if(tank->distance() == minDistance) + { + totalPrice -= tank->price(); + break; + } + } + if(maxDistance == 0) return 0; + return totalPrice / ((maxDistance - minDistance)/ 100.0); +} +double Car::budget_cost_total() +{ + // returns total costs for all bills + double total=0; + foreach(Cost *cost,_costlist) + { + total += cost->cost(); + } + return total; +} +double Car::budget_cost() +{ + //returns costs for bills per 100KM + if (maxdistance()-mindistance() ==0) return 0; + return budget_cost_total() / ((maxdistance() - mindistance())/ 100.0); +} +double Car::budget_invest_total() +{ + //returns buying costs + return _buyingprice - _sellingprice; +} +double Car::budget_invest() +{ + //returns bying costs per 100 KM + QDate today = QDate::currentDate(); + unsigned int monthsused = 1; + double valuecosts; + if (maxdistance()==mindistance() ) return 0.0; + if (_buyingdate.toString()=="") + { + qDebug() << "Invalid buying date "; + double tmp = (_buyingprice-_sellingprice)/(maxdistance()-mindistance())*100.0; + qDebug() << tmp; + return tmp; + } + while (_buyingdate.addMonths(monthsused) < today) + { + monthsused++; + } + if ((monthsused < _lifetime) && (_lifetime !=0)) + valuecosts = (_buyingprice - _sellingprice)*monthsused/_lifetime; + else valuecosts = (_buyingprice - _sellingprice); + return valuecosts / ((maxdistance() - mindistance())/ 100.0); +} +double Car::budget_tire() +{ + //returns tire costs per 100km return budget_tire_total() / ((maxdistance() - mindistance())/ 100.0); } - double Car::budget_tire_total() { + //returns total tire costs double total = 0; foreach (Tire *tire, _tirelist) { @@ -728,13 +750,15 @@ double Car::budget_tire_total() double Car::budget_total() { - return budget_fuel_total() + budget_cost_total()+budget_tire_total(); + //returns all costs + return budget_cost_total() + budget_fuel_total() + budget_tire_total() + budget_invest_total(); } - double Car::budget() { - return budget_fuel() + budget_cost()+ budget_tire(); + // Return total costs / ODO * 100 + return budget_cost()+budget_fuel()+budget_invest()+budget_tire(); } + void Car::addNewTank(QDate date, unsigned int distance, double quantity, double price, bool full, unsigned int fueltype, unsigned int station, QString note) { Tank *tank = new Tank(date, distance, quantity, price, full, fueltype, station, CREATE_NEW_EVENT, note, this); @@ -1276,11 +1300,169 @@ void Car::setNbtire(unsigned int nbtire) else query.exec(QString("UPDATE CarBudget SET value='%1' WHERE id='nbtire';").arg(nbtire)); - qDebug() << "Change distanceunity in database: " << _nbtire; + qDebug() << "Change number of tires in database: " << _nbtire; } _nbtire = nbtire; emit nbtireChanged(); } + +double Car::buyingprice() +{ + if(_buyingprice == 0) + { + QSqlQuery query(this->db); + + if(query.exec("SELECT value FROM CarBudget WHERE id='buyingprice';")) + { + query.next(); + _buyingprice = query.value(0).toDouble(); + qDebug() << "Find buyingprice in database: " << _buyingprice; + } + if(_buyingprice == 0) + { + qDebug() << "Buying price not set in database, set to 0"; + query.exec("INSERT INTO CarBudget (id, value) VALUES ('buyingprice','0');"); + _buyingprice = 0; + } + } + return _buyingprice; +} + +void Car::setBuyingprice(double price) +{ + QSqlQuery query(this->db); + + if(query.exec("SELECT count(*) FROM CarBudget WHERE id='buyingprice';")) + { + query.next(); + if(query.value(0).toString().toInt() < 1) + query.exec(QString("INSERT INTO CarBudget (id, value) VALUES ('buyingprice','%1');").arg(price)); + else + query.exec(QString("UPDATE CarBudget SET value='%1' WHERE id='buyingprice';").arg(price)); + + qDebug() << "Change buyingprice in database: " << price; + } + _buyingprice = price; + emit buyingpriceChanged(); +} + +double Car::sellingprice() +{ + if(_sellingprice == 0) + { + QSqlQuery query(this->db); + + if(query.exec("SELECT value FROM CarBudget WHERE id='sellingprice';")) + { + query.next(); + _sellingprice = query.value(0).toDouble(); + qDebug() << "Find sellingprice in database: " << _sellingprice; + } + if(_sellingprice == 0) + { + qDebug() << "Selling price not set in database, set to 0"; + query.exec("INSERT INTO CarBudget (id, value) VALUES ('sellingprice','0');"); + _sellingprice = 0; + } + } + return _sellingprice; +} + +void Car::setSellingprice(double price) +{ + QSqlQuery query(this->db); + + if(query.exec("SELECT count(*) FROM CarBudget WHERE id='sellingprice';")) + { + query.next(); + if(query.value(0).toString().toInt() < 1) + query.exec(QString("INSERT INTO CarBudget (id, value) VALUES ('sellingprice','%1');").arg(price)); + else + query.exec(QString("UPDATE CarBudget SET value='%1' WHERE id='sellingprice';").arg(price)); + + qDebug() << "Change sellingprice in database: " << price; + } + _sellingprice = price; + emit sellingpriceChanged(); +} + +unsigned int Car::lifetime() +{ + if(_lifetime == 0) + { + QSqlQuery query(this->db); + + if(query.exec("SELECT value FROM CarBudget WHERE id='lifetime';")) + { + query.next(); + _lifetime = query.value(0).toInt(); + qDebug() << "Find lifetime in database: " << _lifetime; + } + if(_lifetime == 0) + { + qDebug() << "Default lifetime not set in database, set to 0"; + query.exec("INSERT INTO CarBudget (id, value) VALUES ('lifetime','0');"); + _lifetime = 0; + } + } + return _lifetime; +} + +void Car::setLifetime(int months) +{ + QSqlQuery query(this->db); + + if(query.exec("SELECT count(*) FROM CarBudget WHERE id='lifetime';")) + { + query.next(); + if(query.value(0).toString().toInt() < 1) + query.exec(QString("INSERT INTO CarBudget (id, value) VALUES ('lifetime','%1');").arg(months)); + else + query.exec(QString("UPDATE CarBudget SET value='%1' WHERE id='lifetime';").arg(months)); + + qDebug() << "Change lifetime in database: " << months; + } + _lifetime = months; + emit lifetimeChanged(); +} + +QDate Car::buyingdate() +{ + QSqlQuery query(this->db); + + if(query.exec("SELECT value FROM CarBudget WHERE id='buyingdate';")) + { + query.next(); + _buyingdate = QDate::fromString(query.value(0).toString()); + qDebug() << "Find buying date in database: " << _buyingdate; + } + else + { + qDebug() << "buying date not set in database, set to today"; + query.exec(QString("INSERT INTO CarBudget (id, value) VALUES ('buyingdate','%1');").arg(QDate::currentDate().toString())); + _buyingdate = QDate::currentDate(); + } + return _buyingdate; +} + +void Car::setBuyingdate(QDate date) +{ + QSqlQuery query(this->db); + qDebug() << "setBuyingdate invoked"; + if(query.exec("SELECT count(*) FROM CarBudget WHERE id='buyingdate';")) + { + query.next(); + if(query.value(0).toString().toInt() < 1) + query.exec(QString("INSERT INTO CarBudget (id, value) VALUES ('buyingdate','%1');").arg(date.toString())); + else + query.exec(QString("UPDATE CarBudget SET value='%1' WHERE id='buyingdate';").arg(date.toString())); + + qDebug() << "Change buying date in database: " << date; + } + _buyingdate = date; + emit buyingdateChanged(); +} + void Car::simulation() { Tire *winter1, *winter2, *summer1; diff --git a/car.h b/car.h index 629edd4..ffff4d2 100644 --- a/car.h +++ b/car.h @@ -62,14 +62,19 @@ class Car : public QObject Q_PROPERTY(QString currency READ currency WRITE setCurrency NOTIFY currencyChanged()) Q_PROPERTY(QString distanceunity READ distanceunity WRITE setDistanceunity NOTIFY distanceunityChanged()) Q_PROPERTY(unsigned int nbtire READ nbtire WRITE setNbtire NOTIFY nbtireChanged) - + Q_PROPERTY(double buyingprice READ buyingprice WRITE setBuyingprice NOTIFY buyingpriceChanged) + Q_PROPERTY(double sellingprice READ sellingprice WRITE setSellingprice NOTIFY sellingpriceChanged) + Q_PROPERTY(unsigned int lifetime READ lifetime WRITE setLifetime NOTIFY lifetimeChanged) + Q_PROPERTY(QDate buyingdate READ buyingdate WRITE setBuyingdate NOTIFY buyingdateChanged) Q_PROPERTY(double budget_fuel_total READ budget_fuel_total NOTIFY budgetChanged) Q_PROPERTY(double budget_fuel READ budget_fuel NOTIFY budgetChanged) Q_PROPERTY(double budget_cost_total READ budget_cost_total NOTIFY budgetChanged) Q_PROPERTY(double budget_cost READ budget_cost NOTIFY budgetChanged) - Q_PROPERTY(double budget_total READ budget_total NOTIFY budgetChanged) Q_PROPERTY(double budget_tire_total READ budget_tire_total NOTIFY budgetChanged) Q_PROPERTY(double budget_tire READ budget_tire NOTIFY budgetChanged) + Q_PROPERTY(double budget_invest_total READ budget_invest_total NOTIFY budgetChanged) + Q_PROPERTY(double budget_invest READ budget_invest NOTIFY budgetChanged) + Q_PROPERTY(double budget_total READ budget_total NOTIFY budgetChanged) Q_PROPERTY(double budget READ budget NOTIFY budgetChanged) @@ -89,6 +94,10 @@ class Car : public QObject QString _distanceunity; unsigned int _nbtire; + double _buyingprice; + double _sellingprice; + unsigned int _lifetime; + QDate _buyingdate; void db_init(); void db_load(); @@ -128,21 +137,23 @@ class Car : public QObject unsigned long int getDistance(QDate Date); - double budget_fuel_total(); Q_INVOKABLE double budget_fuel_byType(unsigned int id); Q_INVOKABLE double budget_fuel_total_byType(unsigned int id); - double budget_fuel(); Q_INVOKABLE double budget_consumption_byType(unsigned int id); Q_INVOKABLE double budget_consumption_max_byType(unsigned int id); Q_INVOKABLE double budget_consumption_min_byType(unsigned int id); - double budget_cost_total(); Q_INVOKABLE double budget_cost_total_byType(unsigned int id); - double budget_cost(); Q_INVOKABLE double budget_cost_byType(unsigned int id); - double budget_total(); - double budget(); + double budget_fuel_total(); + double budget_fuel(); + double budget_cost_total(); + double budget_cost(); double budget_tire_total(); double budget_tire(); + double budget_invest_total(); + double budget_invest(); + double budget(); + double budget_total(); signals: void nbtankChanged(unsigned int nbtank); @@ -164,7 +175,10 @@ class Car : public QObject void currencyChanged(); void distanceunityChanged(); void nbtireChanged(); - + void sellingpriceChanged(); + void buyingpriceChanged(); + void lifetimeChanged(); + void buyingdateChanged(); void budgetChanged(); public slots: @@ -206,6 +220,18 @@ public slots: unsigned int nbtire(); void setNbtire(unsigned int nbtire); + double buyingprice(); + void setBuyingprice(double price); + + double sellingprice(); + void setSellingprice(double price); + + unsigned int lifetime(); + void setLifetime(int months); + + QDate buyingdate(); + void setBuyingdate(QDate date); + }; diff --git a/qml/pages/BudgetView.qml b/qml/pages/BudgetView.qml index 17edbdd..63ca188 100644 --- a/qml/pages/BudgetView.qml +++ b/qml/pages/BudgetView.qml @@ -83,6 +83,15 @@ Page { ctx.lineTo(centerX,centerY) ctx.fill() ctx.stroke() + startangle=endangle + endangle = startangle+manager.car.budget_invest_total*angle + ctx.fillStyle = "grey" + ctx.beginPath() + ctx.moveTo(centerX,centerY) + ctx.arc(centerX,centerY,radius,startangle,endangle,false) + ctx.lineTo(centerX,centerY) + ctx.fill() + ctx.stroke() } } Rectangle { @@ -144,6 +153,22 @@ Page { } } } + Row { + width:parent.width + Rectangle { + color: "grey" + width:parent.width + height:investLegend.height + Text { + id:investLegend + text : qsTr("Invest:") + " " + (manager.car.budget_invest_total*100/manager.car.budget_total).toFixed(2) + "%" + font.family: Theme.fontFamily + font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + horizontalAlignment: Text.AlignLeft + } + } + } } } @@ -391,7 +416,7 @@ Page { id:tirecostsRow width: parent.width Rectangle { - height: fueltext.height + height: tiretext.height width: parent.width color: "transparent" Text { @@ -421,6 +446,33 @@ Page { */ } } + Row { + id:buyingcostsRow + width: parent.width + Rectangle { + height: fueltext.height + width: parent.width + color: "transparent" + Text { + id: buyingcosttext + width:parent.width/2 + text : qsTr("Invest:") + font.family: Theme.fontFamily + font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + horizontalAlignment: Text.AlignLeft + } + Text { + anchors.right:parent.right + width:parent.width/2 + text : manager.car.budget_invest_total.toFixed(2) + " " + manager.car.currency + font.family: "monospaced" + font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + horizontalAlignment: Text.AlignRight + } + } + } Row { id: totalcostsRow width: parent.width @@ -490,12 +542,12 @@ Page { id:billsper100Row width: parent.width Rectangle { - height: billbtext.height + height: billsper100text.height width: parent.width color: "transparent" Text { - id: billbtext + id: billsper100text width:parent.width/2 text : qsTr("Bills:") font.family: Theme.fontFamily @@ -523,7 +575,7 @@ Page { id:tiresper100Row width: parent.width Rectangle { - height: billbtext.height + height: tiresper100text.height width: parent.width color: "transparent" @@ -554,6 +606,34 @@ Page { */ } } + Row { + id:buyingper100Row + width: parent.width + Rectangle { + height: buyingper100text.height + width: parent.width + color: "transparent" + + Text { + id: buyingper100text + width:parent.width/2 + text : qsTr("Buying:") + font.family: Theme.fontFamily + font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + horizontalAlignment: Text.AlignLeft + } + Text { + width:parent.width/2 + anchors.right:parent.right + text : manager.car.budget_invest.toFixed(2) + " " + manager.car.currency + font.family: "monospaced" + font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + horizontalAlignment: Text.AlignRight + } + } + } Row { id: totalper100Row width: parent.width diff --git a/qml/pages/Settings.qml b/qml/pages/Settings.qml index cce6661..c2d9f64 100644 --- a/qml/pages/Settings.qml +++ b/qml/pages/Settings.qml @@ -24,8 +24,7 @@ import harbour.carbudget 1.0 Dialog { - property Cost cost - property date cost_date + property date buying_date SilicaFlickable { @@ -64,10 +63,9 @@ Dialog { placeholderText: qsTr("Km or Mile") EnterKey.enabled: text.length > 0 && acceptableInput == true - //EnterKey.onClicked: descinput.focus = true - //EnterKey.iconSource: "image://theme/icon-m-enter-next" + EnterKey.onClicked: nbtire.focus = true + EnterKey.iconSource: "image://theme/icon-m-enter-next" } - TextField { id: nbtire anchors { left: parent.left; right: parent.right } @@ -76,6 +74,59 @@ Dialog { placeholderText: qsTr("2, 4, 6 or 8") validator: RegExpValidator { regExp: /^[2,4,6,8]$/ } + EnterKey.enabled: text.length > 0 && acceptableInput == true + EnterKey.onClicked: buyingdate.focus = true + EnterKey.iconSource: "image://theme/icon-m-enter-next" + } + ValueButton { + function openDateDialog() + { + var date = buying_date + var dialog = pageStack.push("Sailfish.Silica.DatePickerDialog", { date: date }) + + dialog.accepted.connect(function() + { + value = dialog.date.toLocaleDateString(Qt.locale(),"d MMM yyyy") + buying_date = dialog.date + buyingprice.focus=true + }) + } + + label: qsTr("Buying date") + value: buying_date.toLocaleDateString(Qt.locale(),"d MMM yyyy") + width: parent.width + onClicked: openDateDialog() + } + + TextField { + id: buyingprice + anchors { left: parent.left; right: parent.right } + focus: true + label: qsTr("Buying Price") + validator: RegExpValidator { regExp: /^[0-9\.,]{1,6}$/ } + + EnterKey.enabled: text.length > 0 && acceptableInput == true + EnterKey.onClicked: sellingprice.focus = true + EnterKey.iconSource: "image://theme/icon-m-enter-next" + } + TextField { + id: sellingprice + anchors { left: parent.left; right: parent.right } + focus: true + label: qsTr("Selling Price (est.)") + validator: RegExpValidator { regExp: /^[0-9\.,]{1,6}$/ } + + EnterKey.enabled: text.length > 0 && acceptableInput == true + EnterKey.onClicked: lifetime.focus = true + EnterKey.iconSource: "image://theme/icon-m-enter-next" + } + TextField { + id: lifetime + anchors { left: parent.left; right: parent.right } + focus: true + label: qsTr("Lifetime (in months, est.)") + validator: RegExpValidator { regExp: /^[0-9]{1,4}$/ } + EnterKey.enabled: text.length > 0 && acceptableInput == true //EnterKey.onClicked: descinput.focus = true //EnterKey.iconSource: "image://theme/icon-m-enter-next" @@ -88,11 +139,19 @@ Dialog { currencyinput.text = manager.car.currency distanceunity.text = manager.car.distanceunity nbtire.text = manager.car.nbtire + buying_date = manager.car.buyingdate + buyingprice.text = manager.car.buyingprice + sellingprice.text = manager.car.sellingprice + lifetime.text = manager.car.lifetime } onAccepted: { manager.car.currency = currencyinput.text manager.car.distanceunity = distanceunity.text manager.car.nbtire = nbtire.text + manager.car.buyingdate = buying_date + manager.car.buyingprice = buyingprice.text + manager.car.sellingprice = sellingprice.text + manager.car.lifetime = lifetime.text } } From 72e792364c954651ff2dcc1fd005dbb89ef31350 Mon Sep 17 00:00:00 2001 From: thmichel Date: Wed, 20 May 2015 10:52:20 +0200 Subject: [PATCH 2/2] fixed Bug: Flicable in BudgetView not clipping --- car.cpp | 3 --- qml/pages/BudgetView.qml | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/car.cpp b/car.cpp index b7d0e0e..6bc6ffe 100644 --- a/car.cpp +++ b/car.cpp @@ -664,7 +664,6 @@ double Car::budget_fuel_total() } double Car::budget_fuel() { -<<<<<<< HEAD /* Return sum(fuel price) / ODO * 100 */ unsigned long int maxDistance = 0; unsigned long int minDistance = 999999999; @@ -736,8 +735,6 @@ double Car::budget_invest() double Car::budget_tire() { //returns tire costs per 100km -======= ->>>>>>> upstream/master return budget_tire_total() / ((maxdistance() - mindistance())/ 100.0); } double Car::budget_tire_total() diff --git a/qml/pages/BudgetView.qml b/qml/pages/BudgetView.qml index 63ca188..5a81394 100644 --- a/qml/pages/BudgetView.qml +++ b/qml/pages/BudgetView.qml @@ -42,10 +42,9 @@ Page { id: pieChart width: { return parent.width < parent.height ? parent.width/2 : parent.height/2 } height: { return parent.width < parent.height ? parent.width/2 : parent.height/2 } - //width: budgetPage.width/2 - //height:budgetPage.height/2 anchors.top: header.bottom anchors.left: parent.left + onPaint: { var ctx = pieChart.getContext('2d') ctx.clearRect(0,0,width,height) @@ -182,6 +181,8 @@ Page { leftMargin: Theme.paddingMedium rightMargin: Theme.paddingMedium contentHeight: dataColumn.height + clip:true + Column { id: dataColumn width: parent.width- Theme.paddingMedium - Theme.paddingMedium