From d98b1a80642331b013481c50bea18b812ee14dc9 Mon Sep 17 00:00:00 2001 From: dogmaphobic Date: Sun, 8 Mar 2015 16:00:24 -0400 Subject: [PATCH] Initial Battery Config --- qgroundcontrol.pro | 2 + qgroundcontrol.qrc | 13 +- .../PX4/Images/PowerComponentIcon.png | Bin 0 -> 19189 bytes .../PX4/PX4AutoPilotPlugin.cc | 5 + src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h | 5 +- .../PX4/ParameterFactMetaData.xml | 3 + src/AutoPilotPlugins/PX4/PowerComponent.cc | 118 ++++++++++++++++++ src/AutoPilotPlugins/PX4/PowerComponent.h | 60 +++++++++ src/AutoPilotPlugins/PX4/PowerComponent.qml | 116 +++++++++++++++++ .../PX4/PowerComponentSummary.qml | 80 ++++++++++++ src/QmlControls/QGCColoredImage.qml | 6 +- 11 files changed, 395 insertions(+), 13 deletions(-) create mode 100644 src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png create mode 100644 src/AutoPilotPlugins/PX4/PowerComponent.cc create mode 100644 src/AutoPilotPlugins/PX4/PowerComponent.h create mode 100644 src/AutoPilotPlugins/PX4/PowerComponent.qml create mode 100644 src/AutoPilotPlugins/PX4/PowerComponentSummary.qml diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index ffbc0bf66..15676750a 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -742,6 +742,7 @@ HEADERS+= \ src/AutoPilotPlugins/PX4/SensorsComponent.h \ src/AutoPilotPlugins/PX4/SensorsComponentController.h \ src/AutoPilotPlugins/PX4/SafetyComponent.h \ + src/AutoPilotPlugins/PX4/PowerComponent.h \ src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \ SOURCES += \ @@ -764,6 +765,7 @@ SOURCES += \ src/AutoPilotPlugins/PX4/SensorsComponent.cc \ src/AutoPilotPlugins/PX4/SensorsComponentController.cc \ src/AutoPilotPlugins/PX4/SafetyComponent.cc \ + src/AutoPilotPlugins/PX4/PowerComponent.cc \ src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \ # Fact System code diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 16459b2f4..3210730c1 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -247,13 +247,11 @@ src/test.qml src/QmlControls/QmlTest.qml - src/FactSystem/FactControls/qmldir src/FactSystem/FactControls/FactLabel.qml src/FactSystem/FactControls/FactTextField.qml src/FactSystem/FactControls/FactCheckBox.qml src/FactSystem/FactControls/FactComboBox.qml - src/QmlControls/qmldir src/QmlControls/QGCButton.qml src/QmlControls/QGCRadioButton.qml @@ -263,30 +261,26 @@ src/QmlControls/QGCComboBox.qml src/QmlControls/QGCColoredImage.qml src/QmlControls/QGCToolBarButton.qml - src/QmlControls/SubMenuButton.qml src/QmlControls/IndicatorButton.qml src/QmlControls/VehicleRotationCal.qml - src/QmlControls/arrow-down.png - files/images/px4/airframes/octo_x.png files/images/px4/boards/px4fmu_2.x.png src/VehicleSetup/SetupViewButtons.qml src/VehicleSetup/VehicleSummary.qml src/VehicleSetup/FirmwareUpgrade.qml - src/AutoPilotPlugins/PX4/SafetyComponent.qml + src/AutoPilotPlugins/PX4/PowerComponent.qml src/AutoPilotPlugins/PX4/SensorsComponent.qml src/AutoPilotPlugins/PX4/FlightModesComponent.qml - src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml + src/AutoPilotPlugins/PX4/PowerComponentSummary.qml src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml src/AutoPilotPlugins/PX4/RadioComponentSummary.qml src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml - src/AutoPilotPlugins/PX4/Images/SafetyComponentTree.png src/AutoPilotPlugins/PX4/Images/SafetyComponentHome.png src/AutoPilotPlugins/PX4/Images/SafetyComponentArrowDown.png @@ -297,16 +291,15 @@ src/AutoPilotPlugins/PX4/Images/VehicleRight.png src/AutoPilotPlugins/PX4/Images/VehicleNoseDown.png src/AutoPilotPlugins/PX4/Images/VehicleTailDown.png - files/Setup/cogwheels.png src/AutoPilotPlugins/PX4/Images/SensorsComponentIcon.png src/AutoPilotPlugins/PX4/Images/RadioComponentIcon.png src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png src/AutoPilotPlugins/PX4/Images/AirframeComponentIcon.png src/AutoPilotPlugins/PX4/Images/SafetyComponentIcon.png + src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png src/VehicleSetup/FirmwareUpgradeIcon.png src/VehicleSetup/VehicleSummaryIcon.png - src/ui/toolbar/MainToolBar.qml diff --git a/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png b/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..cba13b67525fa2e315ea53d7ac3e0eb3474cb834 GIT binary patch literal 19189 zcmeI4cT`i^_Q!8RuZAipVu&=6kPupk5I{l+7&;OZBtQbhP(m*%Bwzs)2doqo2N4vM z{!l~rp2Su13?IN3>w zFA)a-K#FKja037cXaWyJg~8v2Qz<*ZKVnRK?`Qy6escZ?GN;sZ8UV1mbPsY2nY0!c z7!juDPmKtm=_Q0Q=e2;DMFP`5kU@)q2hf7);pT|pre*}3PBlk(8IjN=rZp{uZl4rI zb5C;e2uxxGnoYqx4NpO;KnJ3WGs{5yE&L!dx7XKsg)zSs3XlHE4y1@m@Mog*_0Xta ziKv0!G|bqj(1oE<15vb4S{N-nCK}Y~|5C>ciHM1a4vF}OlHV@>V_|SjNThGIe>vW; zuwRyrj)5{>oH$KVW&a7M;Rv>^_S=1TG<@~0f62r4}&@mD#pI0G={ z_Z(c2Kj#2<5Y<1%|3AvY9m|!68i)&uhzj$M!PCS1gJ~#cc(57jyOS&OTVLUkA(ZRFMKa?wGe)Rus ziC?7oTPb^bG}xhuT%8N{@4{*3PK*4}``3j~`ogKi^pA?B&F?vL#9y24+cEa-l$zHp z>|LC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x>kqPuu8q>wlxncKKU@PJam(gWm&BO z6O&gf|Eyi-;)f^K`fkEOobMrY$76uTGpr4R(JL^Z4WC4J*j-W;KlTg@D^S zz^&D4SnUQ;n_yg|TU6?eGQfVgH@$DWQ|3lh-$Ry=Y@GLzHe!{#@mbdSM&TWcR{^&G zKZK(AA~pB(R(d_6s_;1c(Rxz_;M8wyLf4;Y%yz_CYtgcY(ZWnDvzl}Yun$~=KHMAc zS1l$`+YYrv#t)XZek_d@lLzQ5XPKPD8K}VM2a0l;{Dp&pLp{dFq3|qymZ%vHAU9JO zf{%ops>Kuly7bkOyz#NAD5z!VS*pBo8moLW~cY|ZiM%8~@ zSIbJii)RMctkqlvCcSym5b&xrE$msA;BkBJq(me$M2 zAj%Dxvep{YFsr#wxuU`c+V3&z|?m}TJ6*tQ@ zNSIWHNl_iV;x;!vmj{7kLmjA#9yW^gB<&KVG!hqE7Au*FhVJu8D_DBII|_W_Ag%`x zm%-0qh;3F<8-op*`B1pqT4T*U%EJT?i?W_ZB`Z`sxXE&6N4yakFI5SdV-H7VWG*Be z0ONdwHF^fxaLp-3U=NhdJGwQaMBiDLxC}NVq=}Ln9U-ul#vQO~VG%8p-%UK``zl?2 z=ZSQ3+V3CqH~+ECmk)0cxBO=V0XwnKWY*Zb%k%%3ifH3Rs8~Zu{Xf8$ B&hh{N literal 0 HcmV?d00001 diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index e9e553efe..0bf534915 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -70,6 +70,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) : _flightModesComponent(NULL), _sensorsComponent(NULL), _safetyComponent(NULL), + _powerComponent(NULL), _incorrectParameterVersion(false) { Q_ASSERT(uas); @@ -214,6 +215,10 @@ const QVariantList& PX4AutoPilotPlugin::components(void) Q_CHECK_PTR(_sensorsComponent); _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); + _powerComponent = new PowerComponent(_uas, this); + Q_CHECK_PTR(_powerComponent); + _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent)); + _safetyComponent = new SafetyComponent(_uas, this); Q_CHECK_PTR(_safetyComponent); _components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent)); diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h index 92e1499c0..47c6ee592 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h @@ -33,6 +33,7 @@ #include "FlightModesComponent.h" #include "SensorsComponent.h" #include "SafetyComponent.h" +#include "PowerComponent.h" #include @@ -64,7 +65,8 @@ public: FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; } SensorsComponent* sensorsComponent(void) { return _sensorsComponent; } SafetyComponent* safetyComponent(void) { return _safetyComponent; } - + PowerComponent* powerComponent(void) { return _powerComponent; } + private slots: void _checkForIncorrectParameterVersion(void); @@ -76,6 +78,7 @@ private: FlightModesComponent* _flightModesComponent; SensorsComponent* _sensorsComponent; SafetyComponent* _safetyComponent; + PowerComponent* _powerComponent; bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed }; diff --git a/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml b/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml index bde8da849..9a27ed5a4 100644 --- a/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml +++ b/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml @@ -5,17 +5,20 @@ Empty cell voltage Defines the voltage where a single cell of the battery is considered empty. 3.4 + V Full cell voltage Defines the voltage where a single cell of the battery is considered full. 4.2 + V Voltage drop per cell on 100% load This implicitely defines the internal resistance to maximum current ratio and assumes linearity. 0.07 + V Number of cells diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.cc b/src/AutoPilotPlugins/PX4/PowerComponent.cc new file mode 100644 index 000000000..5a3ff31f1 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/PowerComponent.cc @@ -0,0 +1,118 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Gus Grubba + +#include "PowerComponent.h" +#include "PX4RCCalibration.h" +#include "QGCQmlWidgetHolder.h" +#include "PX4AutoPilotPlugin.h" + +PowerComponent::PowerComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) : + PX4Component(uas, autopilot, parent), + _name(tr("Power")) +{ +} + +QString PowerComponent::name(void) const +{ + return _name; +} + +QString PowerComponent::description(void) const +{ + return tr("The Power Component is used to setup battery parameters as well as advanced settings for propellers and magnetometer."); +} + +QString PowerComponent::iconResource(void) const +{ + return "PowerComponentIcon.png"; +} + +bool PowerComponent::requiresSetup(void) const +{ + return true; +} + +bool PowerComponent::setupComplete(void) const +{ + QVariant cvalue, evalue, nvalue; + if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_V_CHARGED", cvalue)) { + if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_V_EMPTY", evalue)) { + if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_N_CELLS", nvalue)) { + return (cvalue.toFloat() > 0.1f) && (evalue.toFloat() > 0.1f) && (nvalue.toInt() > 0); + } + } + } + Q_ASSERT(false); + return false; +} + +QString PowerComponent::setupStateDescription(void) const +{ + const char* stateDescription; + + if (requiresSetup()) { + stateDescription = "Requires setup"; + } else { + stateDescription = "Setup complete"; + } + return QString(stateDescription); +} + +QStringList PowerComponent::setupCompleteChangedTriggerList(void) const +{ + return QStringList(); +} + +QStringList PowerComponent::paramFilterList(void) const +{ + QStringList list; + + return list; +} + +QWidget* PowerComponent::setupWidget(void) const +{ + QGCQmlWidgetHolder* holder = new QGCQmlWidgetHolder(); + Q_CHECK_PTR(holder); + holder->setAutoPilot(_autopilot); + holder->setSource(QUrl::fromUserInput("qrc:/qml/PowerComponent.qml")); + return holder; +} + +QUrl PowerComponent::summaryQmlSource(void) const +{ + return QUrl::fromUserInput("qrc:/qml/PowerComponentSummary.qml"); +} + +QString PowerComponent::prerequisiteSetup(void) const +{ + PX4AutoPilotPlugin* plugin = dynamic_cast(_autopilot); + Q_ASSERT(plugin); + if (!plugin->airframeComponent()->setupComplete()) { + return plugin->airframeComponent()->name(); + } + return QString(); +} diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.h b/src/AutoPilotPlugins/PX4/PowerComponent.h new file mode 100644 index 000000000..a89ef9a4a --- /dev/null +++ b/src/AutoPilotPlugins/PX4/PowerComponent.h @@ -0,0 +1,60 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +#ifndef PowerComponent_H +#define PowerComponent_H + +#include "PX4Component.h" + +/// @file +/// @brief Battery, propeller and magnetometer settings +/// @author Gus Grubba + +class PowerComponent : public PX4Component +{ + Q_OBJECT + +public: + PowerComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL); + + // Virtuals from PX4Component + virtual QStringList setupCompleteChangedTriggerList(void) const; + + // Virtuals from VehicleComponent + virtual QString name (void) const; + virtual QString description (void) const; + virtual QString iconResource (void) const; + virtual bool requiresSetup (void) const; + virtual bool setupComplete (void) const; + virtual QString setupStateDescription (void) const; + virtual QWidget* setupWidget (void) const; + virtual QStringList paramFilterList (void) const; + virtual QUrl summaryQmlSource (void) const; + virtual QString prerequisiteSetup (void) const; + +private: + const QString _name; + QVariantList _summaryItems; +}; + +#endif diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml new file mode 100644 index 000000000..671a0cf45 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml @@ -0,0 +1,116 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @brief Battery, propeller and magnetometer settings +/// @author Gus Grubba + +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 + +Rectangle { + QGCPalette { id: palette; colorGroupEnabled: true } + + width: 600 + height: 600 + color: palette.window + + property int firstColumnWidth: 220 + + Column { + anchors.fill: parent + spacing: 10 + + QGCLabel { + text: "POWER CONFIG" + font.pointSize: 20 + } + + Item { height: 1; width: 10 } + + QGCLabel { + text: "Battery" + color: palette.text + font.pointSize: 20 + } + + Rectangle { + width: parent.width + height: 160 + color: palette.windowShade + + Column { + id: batteryColumn + spacing: 10 + anchors.verticalCenter: parent.verticalCenter + x: (parent.x + 20) + + Row { + spacing: 10 + QGCLabel { text: "Number of Cells"; width: firstColumnWidth; anchors.baseline: cellsField.baseline} + FactTextField { + id: cellsField + fact: Fact { name: "BAT_N_CELLS" } + showUnits: true + } + } + + Row { + spacing: 10 + QGCLabel { text: "Full Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battHighField.baseline} + FactTextField { + id: battHighField + fact: Fact { name: "BAT_V_CHARGED" } + showUnits: true + } + } + + Row { + spacing: 10 + QGCLabel { text: "Empty Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battLowField.baseline} + FactTextField { + id: battLowField + fact: Fact { name: "BAT_V_EMPTY" } + showUnits: true + } + } + + Row { + spacing: 10 + QGCLabel { text: "Voltage Drop on Full Load (per cell)"; width: firstColumnWidth; anchors.baseline: battDropField.baseline} + FactTextField { + id: battDropField + fact: Fact { name: "BAT_V_LOAD_DROP" } + showUnits: true + } + } + } + } + } +} diff --git a/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml b/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml new file mode 100644 index 000000000..f2cc77661 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml @@ -0,0 +1,80 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @brief Battery, propeller and magnetometer summary +/// @author Gus Grubba + +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Controls 1.0 + +Column { + anchors.fill: parent + anchors.margins: 8 + + Row { + width: parent.width + QGCLabel { id: battFull; text: "Battery Full:" } + FactLabel { + fact: Fact { name: "BAT_V_CHARGED" } + horizontalAlignment: Text.AlignRight; + width: parent.width - battFull.contentWidth; + } + } + + Row { + width: parent.width + QGCLabel { id: battEmpty; text: "Battery Empty:" } + FactLabel { + fact: Fact { name: "BAT_V_EMPTY" } + horizontalAlignment: Text.AlignRight; + width: parent.width - battEmpty.contentWidth; + } + } + + Row { + width: parent.width + QGCLabel { id: battCells; text: "Number of Cells:" } + FactLabel { + fact: Fact { name: "BAT_N_CELLS" } + horizontalAlignment: Text.AlignRight; + width: parent.width - battCells.contentWidth; + } + } + + Row { + width: parent.width + QGCLabel { id: battDrop; text: "Voltage Drop:" } + FactLabel { + fact: Fact { name: "BAT_V_LOAD_DROP" } + horizontalAlignment: Text.AlignRight; + width: parent.width - battDrop.contentWidth; + } + } + +} diff --git a/src/QmlControls/QGCColoredImage.qml b/src/QmlControls/QGCColoredImage.qml index 72e4ee775..c6d7a4327 100644 --- a/src/QmlControls/QGCColoredImage.qml +++ b/src/QmlControls/QGCColoredImage.qml @@ -1,4 +1,4 @@ -import QtQuick 2.2 +import QtQuick 2.3 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QtGraphicalEffects 1.0 @@ -17,6 +17,7 @@ Item { property alias paintedWidth: image.paintedWidth property alias progress: image.progress property alias smooth: image.smooth + property alias mipmap: image.mipmap property alias source: image.source property alias sourceSize: image.sourceSize property alias status: image.status @@ -28,6 +29,7 @@ Item { Image { id: image smooth: true + mipmap: true visible: false anchors.fill: parent } @@ -37,4 +39,4 @@ Item { source: image color: parent.color } -} \ No newline at end of file +} -- 2.22.0