Changeset 66 in flair-src


Ignore:
Timestamp:
Aug 23, 2016, 2:51:01 PM (8 years ago)
Author:
Thomas Fuhrmann
Message:

Add the reset functionality

Location:
branches/mavlink/tools/FlairGCS/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/mavlink/tools/FlairGCS/src/ListWidget.cpp

    r64 r66  
    1010#include <QListWidgetItem>
    1111#include <QPalette>
     12#include <QStringList>
    1213#include <sstream>
    1314
     
    1920      FormLayout(parent, row, col, name, "ListWidget") {
    2021  listwidget = new QListWidget();
     22  if (internalItemsList == NULL) {
     23    internalItemsList = new QStringList();
     24  }
    2125  // construct the object in 2 times, to have the label above the list
    2226  object_layout->addRow(new QLabel(name));
     
    3640  if (!items.isEmpty()) {
    3741    listwidget->addItems(items);
     42    internalItemsList = new QStringList(items);
    3843  }
     44
    3945}
    4046
     
    7379void ListWidget::ui_to_var(void) {
    7480  currentItemRow = listwidget->currentRow();
     81  internalItemsList->clear();
     82  for (int count = 0; count < listwidget->count(); count++) {
     83    internalItemsList->append(listwidget->item(count)->text());
     84  }
    7585}
    7686
     
    90100void ListWidget::Reset(void) {
    91101  if (currentItemRow != -1) {
    92     // TODO recharger l'élément supprimé si non appliqué ou recharger la variable
    93102    listwidget->setCurrentRow(currentItemRow);
    94103  }
     104  listwidget->clear();
     105  listwidget->addItems(*internalItemsList);
    95106}
    96107
  • branches/mavlink/tools/FlairGCS/src/ListWidget.h

    r64 r66  
    2020class QListWidgetItem;
    2121class QPalette;
     22class QStringList;
    2223
    2324/*! \class ListWidget
     
    105106  QListWidget *listwidget;
    106107  /**
     108   * Store the list of all the items, in order to use the Reset function.
     109   */
     110  QStringList *internalItemsList;
     111  /**
    107112   * The row of the currently selected item.
    108113   */
Note: See TracChangeset for help on using the changeset viewer.