source: flair-src/branches/mavlink/tools/FlairGCS/src/ListWidget.cpp @ 48

Last change on this file since 48 was 48, checked in by Thomas Fuhrmann, 5 years ago

Add ListWidget?

File size: 2.0 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#include "ListWidget.h"
6#include "Layout.h"
7#include <QListWidget>
8#include <QFormLayout>
9#include <QLabel>
10
11#include <iostream>
12
13ListWidget::ListWidget(Layout *parent, int row, int col, QString name)
14    : FormLayout(parent, row, col, name, "ListWidget") {
15  listwidget = new QListWidget();
16  // listwidget->setCurrentIndex(value);
17
18  // combobox_value = value;
19
20  // object_layout->addRow(name, listwidget);
21  object_layout->addRow(new QLabel(name));
22  object_layout->addRow(listwidget);
23
24  // connect(listwidget, SIGNAL(currentIndexChanged(int)), this,
25  //         SLOT(valuechanged(int)));
26
27  // SetValue(QString::number(combobox_value));
28
29  // pour ne pas faire de doublons qd on ajoute des items
30  SetIsExpandable(true);
31}
32
33ListWidget::~ListWidget() { delete listwidget; }
34
35void ListWidget::XmlEvent(QDomElement dom) {
36  if (dom.attribute("item") != "") {
37    QString item = dom.attribute("item");
38    listwidget->addItem(item);
39  }
40  if (dom.attribute("delete") != "") {
41    QListWidgetItem* current_item = listwidget->currentItem();
42    listwidget->removeItemWidget(current_item);
43    if (current_item) { delete current_item; }
44  }
45}
46
47void ListWidget::SetUptodate(void) {
48  // ui_to_var();
49  // ui_to_xml();
50  visible_widget->setPalette(black_pal);
51}
52
53// void ListWidget::ui_to_var(void) { combobox_value = listwidget->currentIndex(); }
54
55// void ListWidget::ui_to_xml(void) {
56//   SetValue(QString::number(listwidget->currentIndex()));
57// }
58
59void ListWidget::Reset(void) { 
60  // listwidget->setCurrentIndex(combobox_value);
61}
62
63void ListWidget::LoadEvent(QDomElement dom) {
64  if (listwidget->isEnabled() == true) {
65    // listwidget->setCurrentIndex((dom.attribute("value")).toInt());
66  }
67}
68
69// void ListWidget::valuechanged(int value) {
70//   if (value != combobox_value) {
71//     visible_widget->setPalette(red_pal);
72//   } else {
73//     visible_widget->setPalette(black_pal);
74//   }
75// }
Note: See TracBrowser for help on using the repository browser.