/*===================================================================== 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 . ======================================================================*/ import QtQuick 2.5 import QtQuick.Controls 1.4 import QGroundControl 1.0 import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 QGCViewDialog { property var missionItem QGCPalette { id: qgcPal } QGCLabel { id: categoryLabel anchors.baseline: categoryCombo.baseline text: "Category:" } QGCComboBox { id: categoryCombo anchors.margins: ScreenTools.defaultFontPixelWidth anchors.left: categoryLabel.right anchors.right: parent.right model: QGroundControl.missionCommands.categories function categorySelected(category) { commandList.model = QGroundControl.missionCommands.getCommandsForCategory(category) console.log("changing model", category) } Component.onCompleted: { var category = missionItem.category currentIndex = find(category) categorySelected(category) } onActivated: categorySelected(textAt(index)) } ListView { id: commandList anchors.margins: ScreenTools.defaultFontPixelHeight anchors.left: parent.left anchors.right: parent.right anchors.top: categoryCombo.bottom anchors.bottom: parent.bottom spacing: ScreenTools.defaultFontPixelHeight / 2 orientation: ListView.Vertical onModelChanged: { var currentCategory = categoryCombo.currentText currentIndex = -1 if (missionItem.category == currentCategory) { var commandList = QGroundControl.missionCommands.getCommandsForCategory(currentCategory) for (var i=0; i