source: flair-src/branches/mavlink/lib/FlairCore/src/ListWidget.cpp@ 53

Last change on this file since 53 was 53, checked in by Thomas Fuhrmann, 8 years ago

Default xml configuration is working with ListWidget

File size: 1.7 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2016/07/26
6// filename: ListWidget.cpp
7//
8// author: Thomas Fuhrmann
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class displaying a QListWidget on the ground station
14//
15//
16/*********************************************************************/
17#include "ListWidget.h"
18#include "Layout.h"
19#include "LayoutPosition.h"
20
21#include <sstream>
22#include <iostream>
23
24using std::string;
25using std::ostringstream;
26
27namespace flair {
28namespace gui {
29
30ListWidget::ListWidget(const LayoutPosition *position, string name)
31 : Widget(position->getLayout(), name, string("ListWidget")) {
32 size_t count = 0;
33 while (1) {
34 string item;
35 ostringstream item_prop;
36 item_prop << "item" << count;
37 if(GetPersistentXmlProp(item_prop.str(), item)) {
38 SetVolatileXmlProp(item_prop.str(), item);
39 items.push_back(item);
40 } else {
41 break;
42 }
43 count++;
44 }
45 // value_changed = true;
46 SetVolatileXmlProp("row", position->Row());
47 SetVolatileXmlProp("col", position->Col());
48 delete position;
49 SendXml();
50}
51
52ListWidget::~ListWidget() { core::Object::ObjectName(); }
53
54void ListWidget::AddItem(string name) {
55 SetVolatileXmlProp("item", name);
56 SendXml();
57}
58
59void ListWidget::RemoveItem(void) {
60 SetVolatileXmlProp("delete", 0);
61 SendXml();
62}
63
64void ListWidget::XmlEvent(void) {
65 std::cout << "FlairCore ListWidget XmlEvent" << std::endl;
66 // GetMutex();
67 // if (GetPersistentXmlProp("value", box_value))
68 // SetValueChanged();
69 // ReleaseMutex();
70}
71
72} // end namespace gui
73} // end namespace flair
Note: See TracBrowser for help on using the repository browser.