Changeset 66 in flair-src
- Timestamp:
- Aug 23, 2016, 2:51:01 PM (8 years ago)
- Location:
- branches/mavlink/tools/FlairGCS/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mavlink/tools/FlairGCS/src/ListWidget.cpp
r64 r66 10 10 #include <QListWidgetItem> 11 11 #include <QPalette> 12 #include <QStringList> 12 13 #include <sstream> 13 14 … … 19 20 FormLayout(parent, row, col, name, "ListWidget") { 20 21 listwidget = new QListWidget(); 22 if (internalItemsList == NULL) { 23 internalItemsList = new QStringList(); 24 } 21 25 // construct the object in 2 times, to have the label above the list 22 26 object_layout->addRow(new QLabel(name)); … … 36 40 if (!items.isEmpty()) { 37 41 listwidget->addItems(items); 42 internalItemsList = new QStringList(items); 38 43 } 44 39 45 } 40 46 … … 73 79 void ListWidget::ui_to_var(void) { 74 80 currentItemRow = listwidget->currentRow(); 81 internalItemsList->clear(); 82 for (int count = 0; count < listwidget->count(); count++) { 83 internalItemsList->append(listwidget->item(count)->text()); 84 } 75 85 } 76 86 … … 90 100 void ListWidget::Reset(void) { 91 101 if (currentItemRow != -1) { 92 // TODO recharger l'élément supprimé si non appliqué ou recharger la variable93 102 listwidget->setCurrentRow(currentItemRow); 94 103 } 104 listwidget->clear(); 105 listwidget->addItems(*internalItemsList); 95 106 } 96 107 -
branches/mavlink/tools/FlairGCS/src/ListWidget.h
r64 r66 20 20 class QListWidgetItem; 21 21 class QPalette; 22 class QStringList; 22 23 23 24 /*! \class ListWidget … … 105 106 QListWidget *listwidget; 106 107 /** 108 * Store the list of all the items, in order to use the Reset function. 109 */ 110 QStringList *internalItemsList; 111 /** 107 112 * The row of the currently selected item. 108 113 */
Note:
See TracChangeset
for help on using the changeset viewer.