Browse Source

Icon support for values display

QGC4.4
DoinLakeFlyer 5 years ago
parent
commit
3f6425f96f
  1. 122
      src/FlightMap/Widgets/ValuePageWidget.qml
  2. 105
      src/FlightMap/Widgets/ValuesWidgetController.cc
  3. 82
      src/FlightMap/Widgets/ValuesWidgetController.h
  4. 5
      src/api/QGCCorePlugin.cc
  5. 5
      src/api/QGCCorePlugin.h

122
src/FlightMap/Widgets/ValuePageWidget.qml

@ -37,6 +37,10 @@ Column { @@ -37,6 +37,10 @@ Column {
property var _valuePickerInstrumentValue: null
property int _valuePickerRowIndex: 0
property var _rgFontSizes: [ ScreenTools.defaultFontPointSize, ScreenTools.smallFontPointSize, ScreenTools.mediumFontPointSize, ScreenTools.largeFontPointSize ]
property var _rgFontSizeRatios: [ 1, ScreenTools.smallFontPointRatio, ScreenTools.mediumFontPointRatio, ScreenTools.largeFontPointRatio ]
property real _doubleDescent: ScreenTools.defaultFontDescent * 2
property real _tightDefaultFontHeight: ScreenTools.defaultFontPixelHeight - _doubleDescent
property var _rgFontSizeTightHeights: [ _tightDefaultFontHeight * _rgFontSizeRatios[0] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[1] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[2] + 2, _tightDefaultFontHeight * _rgFontSizeRatios[3] + 2 ]
property real _blankEntryHeight: ScreenTools.defaultFontPixelHeight * 2
property real _columnButtonWidth: ScreenTools.minTouchPixels / 2
property real _columnButtonHeight: ScreenTools.minTouchPixels
@ -102,16 +106,80 @@ Column { @@ -102,16 +106,80 @@ Column {
property real _interColumnSpacing: (columnRepeater.count - (_settingsUnlocked ? 0 : 1)) * columnRow.spacing
property real columnWidth: (pageWidth - (_settingsUnlocked ? _columnButtonWidth : 0) - _interColumnSpacing) / columnRepeater.count
property bool componentCompleted: false
Component.onCompleted: componentCompleted = true
onItemAdded: valueItemMouseAreaComponent.createObject(item, { "instrumentValue": object.get(index), "rowIndex": index })
Item {
id: columnItem
anchors.verticalCenter: parent.verticalCenter
width: columnRepeater.columnWidth
height: value.y + value.height
anchors.verticalCenter: _settingsUnlocked ? parent.verticalCenter : undefined
anchors.bottom: _settingsUnlocked ? undefined : parent.bottom
property real columnWidth: columnRepeater.columnWidth
property bool repeaterComponentCompleted: columnRepeater.componentCompleted
// After fighting with using layout and/or anchors I gave up and just do a manual recalc to position items which ends up being much simpler
function recalcPositions() {
if (!repeaterComponentCompleted) {
return
}
var smallSpacing = 2
if (object.icon) {
if (object.iconPosition === InstrumentValue.IconAbove) {
valueIcon.x = (width - valueIcon.width) / 2
valueIcon.y = 0
value.x = (width - value.width) / 2
value.y = valueIcon.height + smallSpacing
} else {
var iconPlusValueWidth = valueIcon.width + value.width + ScreenTools.defaultFontPixelWidth
valueIcon.x = (width - iconPlusValueWidth) / 2
valueIcon.y = (value.height - valueIcon.height) / 2
value.x = valueIcon.x + valueIcon.width + (ScreenTools.defaultFontPixelWidth / 2)
value.y = 0
}
label.x = label.y = 0
} else {
// label above value
if (label) {
label.x = (width - label.width) / 2
label.y = 0
value.y = label.height + smallSpacing
} else {
value.y = 0
}
value.x = (width - value.width) / 2
valueIcon.x = valueIcon.y = 0
}
}
onRepeaterComponentCompletedChanged: recalcPositions()
onColumnWidthChanged: recalcPositions()
Connections {
target: object
onIconChanged: recalcPositions()
onIconPositionChanged: recalcPositions()
}
QGCColoredImage {
id: valueIcon
height: _rgFontSizeTightHeights[object.fontSize]
width: height
source: object.icon ? "/InstrumentValueIcons/" + object.icon : ""
sourceSize.height: height
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
color: qgcPal.text
visible: object.icon
onWidthChanged: columnItem.recalcPositions()
onHeightChanged: columnItem.recalcPositions()
}
QGCLabel {
id: blank
anchors.horizontalCenter: parent.horizontalCenter
height: _columnButtonsTotalHeight
font.pointSize: ScreenTools.smallFontPointSize
@ -119,25 +187,29 @@ Column { @@ -119,25 +187,29 @@ Column {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
visible: !object.fact
onWidthChanged: columnItem.recalcPositions()
onHeightChanged: columnItem.recalcPositions()
}
QGCLabel {
id: label
anchors.horizontalCenter: parent.horizontalCenter
height: _rgFontSizeTightHeights[InstrumentValue.SmallFontSize]
font.pointSize: ScreenTools.smallFontPointSize
text: object.label.toUpperCase()
horizontalAlignment: Text.AlignHCenter
visible: object.fact && object.label
verticalAlignment: Text.AlignVCenter
visible: object.fact && object.label && !object.icon
onWidthChanged: columnItem.recalcPositions()
onHeightChanged: columnItem.recalcPositions()
}
QGCLabel {
id: value
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: label.visible ? 2 : 0
anchors.top: label.visible ? label.bottom : parent.top
font.pointSize: _rgFontSizes[object.fontSize]
text: visible ? (object.fact.enumOrValueString + (object.showUnits ? object.fact.units : "")) : ""
verticalAlignment: Text.AlignVCenter
visible: object.fact
onWidthChanged: columnItem.recalcPositions()
onHeightChanged: columnItem.recalcPositions()
}
}
} // Repeater - columns
@ -177,7 +249,7 @@ Column { @@ -177,7 +249,7 @@ Column {
Layout.fillWidth: true
Layout.preferredHeight: ScreenTools.defaultFontPixelWidth * 2
text: qsTr("+")
onClicked: controller.insertRow(index)
onClicked: controller.insertRow(index + 1)
}
QGCButton {
@ -250,13 +322,43 @@ Column { @@ -250,13 +322,43 @@ Column {
QGCLabel { text: qsTr("Font Size (for whole row)") }
QGCComboBox {
id: fontSizeCombo
model: [ qsTr("Default"), qsTr("Small"), qsTr("Medium"), qsTr("Large") ]
model: _valuePickerInstrumentValue.fontSizeNames
currentIndex: _valuePickerInstrumentValue.fontSize
sizeToContents: true
onActivated: _valuePickerInstrumentValue.fontSize = index
}
}
RowLayout {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { text: qsTr("Icon") }
QGCComboBox {
model: _valuePickerInstrumentValue.iconNames
sizeToContents: true
onActivated: _valuePickerInstrumentValue.icon = currentText
Component.onCompleted: {
currentIndex = find(_valuePickerInstrumentValue.icon)
if (currentIndex == -1) {
currentIndex = 0
}
}
}
}
RowLayout {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { text: qsTr("Icon Position") }
QGCComboBox {
model: _valuePickerInstrumentValue.iconPositionNames
currentIndex: _valuePickerInstrumentValue.iconPosition
sizeToContents: true
onActivated: _valuePickerInstrumentValue.iconPosition = index
}
}
QGCCheckBox {
text: qsTr("Show Units")
checked: _valuePickerInstrumentValue.showUnits

105
src/FlightMap/Widgets/ValuesWidgetController.cc

@ -27,6 +27,26 @@ const char* InstrumentValue::_factNameKey = "factName"; @@ -27,6 +27,26 @@ const char* InstrumentValue::_factNameKey = "factName";
const char* InstrumentValue::_labelKey = "label";
const char* InstrumentValue::_fontSizeKey = "fontSize";
const char* InstrumentValue::_showUnitsKey = "showUnits";
const char* InstrumentValue::_iconKey = "icon";
const char* InstrumentValue::_iconPositionKey = "iconPosition";
QStringList InstrumentValue::_iconNames;
const QString InstrumentValue::_noIconName = QT_TRANSLATE_NOOP("InstrumentValue", "No Icon");
// Important: The indices of these strings must match the InstrumentValue::IconPosition enumconst QStringList InstrumentValue::_iconPositionNames = {
const QStringList InstrumentValue::_iconPositionNames = {
QT_TRANSLATE_NOOP("InstrumentValue", "Above"),
QT_TRANSLATE_NOOP("InstrumentValue", "Left"),
};
// Important: The indices of these strings must match the InstrumentValue::FontSize enum
const QStringList InstrumentValue::_fontSizeNames = {
QT_TRANSLATE_NOOP("InstrumentValue", "Default"),
QT_TRANSLATE_NOOP("InstrumentValue", "Small"),
QT_TRANSLATE_NOOP("InstrumentValue", "Medium"),
QT_TRANSLATE_NOOP("InstrumentValue", "Large"),
};
ValuesWidgetController::ValuesWidgetController(bool forDefaultSettingsCreation)
: _valuesModel(new QmlObjectListModel(this))
@ -43,27 +63,31 @@ ValuesWidgetController::ValuesWidgetController(bool forDefaultSettingsCreation) @@ -43,27 +63,31 @@ ValuesWidgetController::ValuesWidgetController(bool forDefaultSettingsCreation)
}
}
InstrumentValue* ValuesWidgetController::_createNewInstrumentValueWorker(Vehicle* activeVehicle, int fontSize, QmlObjectListModel* rowModel)
void ValuesWidgetController::_connectSignalsToController(InstrumentValue* value, ValuesWidgetController* controller)
{
InstrumentValue* newValue = new InstrumentValue(activeVehicle, fontSize, rowModel);
connect(newValue, &InstrumentValue::factChanged, this, &ValuesWidgetController::_saveSettings);
connect(newValue, &InstrumentValue::factGroupNameChanged, this, &ValuesWidgetController::_saveSettings);
connect(newValue, &InstrumentValue::labelChanged, this, &ValuesWidgetController::_saveSettings);
connect(newValue, &InstrumentValue::fontSizeChanged, this, &ValuesWidgetController::_saveSettings);
connect(newValue, &InstrumentValue::showUnitsChanged, this, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::factNameChanged, controller, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::factGroupNameChanged, controller, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::labelChanged, controller, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::fontSizeChanged, controller, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::showUnitsChanged, controller, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::iconChanged, controller, &ValuesWidgetController::_saveSettings);
connect(value, &InstrumentValue::iconPositionChanged, controller, &ValuesWidgetController::_saveSettings);
}
InstrumentValue* ValuesWidgetController::_createNewInstrumentValueWorker(Vehicle* activeVehicle, InstrumentValue::FontSize fontSize, QmlObjectListModel* rowModel)
{
InstrumentValue* newValue = new InstrumentValue(activeVehicle, fontSize, rowModel);
_connectSignalsToController(newValue, this);
return newValue;
}
InstrumentValue* ValuesWidgetController::appendColumn(int rowIndex)
{
InstrumentValue* newValue = nullptr;
if (rowIndex >= 0 && rowIndex < _valuesModel->count()) {
QmlObjectListModel* row = _valuesModel->value<QmlObjectListModel*>(rowIndex);
int fontSize = InstrumentValue::DefaultFontSize;
InstrumentValue::FontSize fontSize = InstrumentValue::DefaultFontSize;
if (row->count()) {
fontSize = row->value<InstrumentValue*>(0)->fontSize();
}
@ -297,13 +321,30 @@ void ValuesWidgetController::setPreventSaveSettings(bool preventSaveSettings) @@ -297,13 +321,30 @@ void ValuesWidgetController::setPreventSaveSettings(bool preventSaveSettings)
_preventSaveSettings = preventSaveSettings;
}
InstrumentValue::InstrumentValue(Vehicle* activeVehicle, int fontSize, QmlObjectListModel* rowModel)
void ValuesWidgetController::setValuesModelParentController(ValuesWidgetController* newParentController)
{
_valuesModel->setParent(newParentController);
// Signalling must be reconnected to new controller as well
for (int rowIndex=0; rowIndex<_valuesModel->count(); rowIndex++) {
QmlObjectListModel* rowModel = _valuesModel->value<QmlObjectListModel*>(rowIndex);
for (int colIndex=0; colIndex<rowModel->count(); colIndex++) {
_connectSignalsToController(rowModel->value<InstrumentValue*>(colIndex), newParentController);
}
}
}
InstrumentValue::InstrumentValue(Vehicle* activeVehicle, FontSize fontSize, QmlObjectListModel* rowModel)
: QObject (rowModel)
, _activeVehicle(activeVehicle)
, _rowModel (rowModel)
, _fontSize (fontSize)
{
if (_iconNames.isEmpty()) {
QDir iconDir(":/InstrumentValueIcons/");
_iconNames = iconDir.entryList();
_iconNames.prepend(_noIconName);
}
}
void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle)
@ -314,7 +355,6 @@ void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle) @@ -314,7 +355,6 @@ void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle)
_fact = nullptr;
FactGroup* factGroup = nullptr;
QString factName;
if (_factGroupName == QStringLiteral("Vehicle")) {
factGroup = _activeVehicle;
} else {
@ -322,7 +362,7 @@ void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle) @@ -322,7 +362,7 @@ void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle)
}
if (factGroup) {
_fact = factGroup->getFact(factName);
_fact = factGroup->getFact(_factName);
}
emit factChanged(_fact);
}
@ -346,19 +386,22 @@ void InstrumentValue::setFact(QString factGroupName, QString factName, QString l @@ -346,19 +386,22 @@ void InstrumentValue::setFact(QString factGroupName, QString factName, QString l
}
if (_fact) {
_factName = factName;
_factGroupName = factGroupName;
_label = label;
} else {
_factName.clear();
_factGroupName.clear();
_label.clear();
}
emit labelChanged(_label);
emit factChanged(_fact);
emit factNameChanged(_factName);
emit factGroupNameChanged(_factGroupName);
}
void InstrumentValue::_setFontSize(int fontSize)
void InstrumentValue::_setFontSize(FontSize fontSize)
{
if (fontSize != _fontSize) {
_fontSize = fontSize;
@ -366,7 +409,7 @@ void InstrumentValue::_setFontSize(int fontSize) @@ -366,7 +409,7 @@ void InstrumentValue::_setFontSize(int fontSize)
}
}
void InstrumentValue::setFontSize(int fontSize)
void InstrumentValue::setFontSize(FontSize fontSize)
{
_setFontSize(fontSize);
@ -391,14 +434,18 @@ void InstrumentValue::saveToSettings(QSettings& settings) const @@ -391,14 +434,18 @@ void InstrumentValue::saveToSettings(QSettings& settings) const
settings.setValue(_labelKey, _label);
settings.setValue(_fontSizeKey, _fontSize);
settings.setValue(_showUnitsKey, _showUnits);
settings.setValue(_iconKey, _icon);
settings.setValue(_iconPositionKey, _iconPosition);
}
void InstrumentValue::readFromSettings(const QSettings& settings)
{
_factGroupName = settings.value(_factGroupNameKey).toString();
_label = settings.value(_labelKey).toString();
_fontSize = settings.value(_fontSizeKey).toInt();
_showUnits = settings.value(_showUnitsKey).toBool();
_fontSize = settings.value(_fontSizeKey, DefaultFontSize).value<FontSize>();
_showUnits = settings.value(_showUnitsKey, true).toBool();
_icon = settings.value(_iconKey).toString();
_iconPosition = settings.value(_iconPositionKey, IconLeft).value<IconPosition>();
QString factName = settings.value(_factNameKey).toString();
if (!factName.isEmpty()) {
@ -410,6 +457,8 @@ void InstrumentValue::readFromSettings(const QSettings& settings) @@ -410,6 +457,8 @@ void InstrumentValue::readFromSettings(const QSettings& settings)
emit labelChanged (_label);
emit fontSizeChanged (_fontSize);
emit showUnitsChanged (_showUnits);
emit iconChanged (_icon);
emit iconPositionChanged (_iconPosition);
}
void InstrumentValue::setLabel(const QString& label)
@ -440,3 +489,23 @@ void InstrumentValue::clearFact(void) @@ -440,3 +489,23 @@ void InstrumentValue::clearFact(void)
emit labelChanged (_label);
emit showUnitsChanged (_showUnits);
}
void InstrumentValue::setIcon(const QString& icon)
{
if (icon != _icon) {
if (icon == _noIconName) {
_icon.clear();
} else {
_icon = icon;
}
emit iconChanged(_icon);
}
}
void InstrumentValue::setIconPosition(IconPosition iconPosition)
{
if (iconPosition != _iconPosition) {
_iconPosition = iconPosition;
emit iconPositionChanged(iconPosition);
}
}

82
src/FlightMap/Widgets/ValuesWidgetController.h

@ -28,56 +28,87 @@ public: @@ -28,56 +28,87 @@ public:
MediumFontSize,
LargeFontSize
};
Q_ENUMS(FontSize)
InstrumentValue(Vehicle* activeVehicle, int fontSize, QmlObjectListModel* rowModel);
enum IconPosition {
IconAbove = 0,
IconLeft
};
Q_ENUMS(IconPosition)
InstrumentValue(Vehicle* activeVehicle, FontSize fontSize, QmlObjectListModel* rowModel);
Q_PROPERTY(QString factGroupName MEMBER _factGroupName NOTIFY factGroupNameChanged)
Q_PROPERTY(Fact* fact READ fact NOTIFY factChanged)
Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(bool showUnits READ showUnits WRITE setShowUnits NOTIFY showUnitsChanged)
Q_PROPERTY(QString factGroupName MEMBER _factGroupName NOTIFY factGroupNameChanged)
Q_PROPERTY(Fact* fact READ fact NOTIFY factChanged)
Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged) ///< If !isEmpty icon will be show instead of label
Q_PROPERTY(IconPosition iconPosition READ iconPosition WRITE setIconPosition NOTIFY iconPositionChanged)
Q_PROPERTY(QStringList iconPositionNames MEMBER _iconPositionNames CONSTANT)
Q_PROPERTY(QStringList iconNames MEMBER _iconNames CONSTANT)
Q_PROPERTY(FontSize fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(QStringList fontSizeNames MEMBER _fontSizeNames CONSTANT)
Q_PROPERTY(bool showUnits READ showUnits WRITE setShowUnits NOTIFY showUnitsChanged)
Q_INVOKABLE void setFact(QString factGroupName, QString factName, QString label);
Q_INVOKABLE void clearFact(void);
Fact* fact (void) { return _fact; }
int fontSize (void) const { return _fontSize; }
QString label (void) const { return _label; }
bool showUnits (void) const { return _showUnits; }
void setFontSize (int fontSize);
void setLabel (const QString& label);
void setShowUnits (bool showUnits);
void activeVehicleChanged (Vehicle* activeVehicle);
void saveToSettings (QSettings& settings) const;
void readFromSettings (const QSettings& settings);
Fact* fact (void) { return _fact; }
FontSize fontSize (void) const { return _fontSize; }
QString label (void) const { return _label; }
bool showUnits (void) const { return _showUnits; }
QString icon (void) const { return _icon; }
IconPosition iconPosition (void) const { return _iconPosition; }
void setFontSize (FontSize fontSize);
void setLabel (const QString& label);
void setShowUnits (bool showUnits);
void setIcon (const QString& icon);
void setIconPosition (IconPosition iconPosition);
void activeVehicleChanged (Vehicle* activeVehicle);
void saveToSettings (QSettings& settings) const;
void readFromSettings (const QSettings& settings);
signals:
void factChanged (Fact* fact);
void factGroupNameChanged (QString factGroup);
void factNameChanged (const QString& factName);
void factGroupNameChanged (const QString& factGroup);
void labelChanged (QString label);
void fontSizeChanged (int fontSize);
void fontSizeChanged (FontSize fontSize);
void showUnitsChanged (bool showUnits);
private slots:
void iconChanged (const QString& icon);
void iconPositionChanged (IconPosition iconPosition);
private:
void _setFontSize(int fontSize);
void _setFontSize (FontSize fontSize);
Vehicle* _activeVehicle = nullptr;
QmlObjectListModel* _rowModel = nullptr;
Fact* _fact = nullptr;
QString _factName;
QString _factGroupName;
QString _label;
bool _showUnits = true;
int _fontSize = DefaultFontSize;
FontSize _fontSize = DefaultFontSize;
QString _icon;
IconPosition _iconPosition = IconLeft;
static const QStringList _iconPositionNames;
static QStringList _iconNames;
static const QStringList _fontSizeNames;
static const char* _factGroupNameKey;
static const char* _factNameKey;
static const char* _labelKey;
static const char* _fontSizeKey;
static const char* _showUnitsKey;
static const char* _iconKey;
static const char* _iconPositionKey;
static const QString _noIconName;
};
Q_DECLARE_METATYPE(InstrumentValue::FontSize)
Q_DECLARE_METATYPE(InstrumentValue::IconPosition)
class ValuesWidgetController : public QObject
{
Q_OBJECT
@ -101,6 +132,9 @@ public: @@ -101,6 +132,9 @@ public:
/// Turn on/off saving changes to QSettings
void setPreventSaveSettings(bool preventSaveSettings);
/// Allows the ownership of the _valuesModel to be re-parented to a different controller
void setValuesModelParentController(ValuesWidgetController* newParentController);
signals:
void valuesModelChanged(QmlObjectListModel* valuesModel);
@ -111,8 +145,10 @@ private slots: @@ -111,8 +145,10 @@ private slots:
private:
bool _validRowIndex (int rowIndex);
InstrumentValue* _createNewInstrumentValueWorker (Vehicle* activeVehicle, int fontSize, QmlObjectListModel* rowModel);
InstrumentValue* _createNewInstrumentValueWorker (Vehicle* activeVehicle, InstrumentValue::FontSize fontSize, QmlObjectListModel* rowModel);
void _loadSettings (void);
void _connectSignalsToController (InstrumentValue* value, ValuesWidgetController* controller);
MultiVehicleManager* _multiVehicleMgr = nullptr;
QmlObjectListModel* _valuesModel = nullptr;

5
src/api/QGCCorePlugin.cc

@ -407,7 +407,7 @@ QString QGCCorePlugin::showAdvancedUIMessage() const @@ -407,7 +407,7 @@ QString QGCCorePlugin::showAdvancedUIMessage() const
"Are you sure you want to enable Advanced Mode?");
}
QmlObjectListModel* QGCCorePlugin::valuesWidgetDefaultSettings(QObject* valuesModelParent)
QmlObjectListModel* QGCCorePlugin::valuesWidgetDefaultSettings(ValuesWidgetController* newParentController)
{
ValuesWidgetController controller(true /* forDefaultSettingsCreation */);
@ -438,7 +438,8 @@ QmlObjectListModel* QGCCorePlugin::valuesWidgetDefaultSettings(QObject* valuesMo @@ -438,7 +438,8 @@ QmlObjectListModel* QGCCorePlugin::valuesWidgetDefaultSettings(QObject* valuesMo
controller.setPreventSaveSettings(false);
controller.valuesModel()->setParent(valuesModelParent);
// Caller takes ownership
controller.setValuesModelParentController(newParentController);
return controller.valuesModel();
}

5
src/api/QGCCorePlugin.h

@ -37,6 +37,7 @@ class PlanMasterController; @@ -37,6 +37,7 @@ class PlanMasterController;
class QGCCameraManager;
class QGCCameraControl;
class QQuickItem;
class ValuesWidgetController;
class QGCCorePlugin : public QGCTool
{
@ -106,8 +107,8 @@ public: @@ -106,8 +107,8 @@ public:
virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo);
/// Return the default Intrument Value model for the Values Widget. The returned model will be
/// re-parented to valuesModelParent for ownership.
virtual QmlObjectListModel* valuesWidgetDefaultSettings(QObject* valuesModelParent);
/// re-parented to parentController for ownership.
virtual QmlObjectListModel* valuesWidgetDefaultSettings(ValuesWidgetController* newParentController);
/// Allows the plugin to override the creation of the root (native) window.
virtual QQmlApplicationEngine* createRootWindow(QObject* parent);

Loading…
Cancel
Save