Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
propeditwidget.cpp
Go to the documentation of this file.
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // propeditwidget.cpp
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 #include <QGridLayout>
10 #include <QHBoxLayout>
11 #include <QPushButton>
12 #include <QTreeWidgetItem>
13 
14 #include "propeditwidget.h"
15 
16 
18  QDialog(parent)
19 {
20 
21  mainObject = mOb;
22 
24 
25  setWindowTitle("Edit Property");
26  setWindowIcon(QIcon(":/icons/node_val"));
27 
28 
29  QGridLayout *grid = new QGridLayout();
30  setLayout(grid);
31  int row = 0;
32 
33  //* Top Label
34  labelNode = new QLabel(this);
35  labelNode->setStyleSheet("font-weight: bold; padding: 5px; background-color: white;");
36  grid->addWidget(labelNode, row, 0, 1, 2);
37 
38  //* Value Edit
39  row++;
40  txtValue = new QLineEdit(this);
41  grid->addWidget(txtValue, row, 0, 1, 1);
42 
43  //* Type
44  labelType = new QLabel(this);
45  grid->addWidget(labelType, row, 1, 1, 1);
46 
47 
48  //* Bottom button Box
49  row++;
50  QHBoxLayout *buttonBox = new QHBoxLayout();
51  grid->addLayout(buttonBox, row, 0, 1, 2);
52  buttonBox->addStretch(10);
53 
54  //* Cancel Button
55  QPushButton *buttonCancel = new QPushButton();
56  buttonCancel->setIcon(QIcon(":/icons/black"));
57  buttonCancel->setText("Cancel");
58  buttonBox->addWidget(buttonCancel);
59  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
60 
61  //* Save Button
62  QPushButton *buttonSave = new QPushButton();
63  buttonSave->setIcon(QIcon(":/icons/save"));
64  buttonSave->setText("Set");
65  buttonBox->addWidget(buttonSave);
66  connect(buttonSave, SIGNAL(clicked()), this, SLOT(on_set_property()));
67 }
68 
69 
70 
71 
73 
74  labelType->setText( item->text(2) );
75  txtValue->setText( item->text(1) );
76  labelNode->setText( item->text(3));
77 
78 }
79 
80 
81 
83 
84  //mainObject->telnet->set_property(labelNode->text(), txtValue->text());
85  accept();
86 }
QLabel * labelNode
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:66
QLabel * labelType
MainObject * mainObject
PropEditWidget(MainObject *mOb, QDialog *parent=0)
void restoreWindow(QWidget *widget)
Restores a size window position.
Definition: xsettings.cpp:101
void set_from_item(QTreeWidgetItem *item)
QLineEdit * txtValue
XSettings * settings
Definition: mainobject.h:85