Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/qt/qt_gui_elements.cc @ 10735

Last change on this file since 10735 was 8145, checked in by bensch, 19 years ago

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 2.3 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "qt_gui_elements.h"
19
20namespace OrxGui
21{
22
23
24
25  QtGuiCheckBox::QtGuiCheckBox(const std::string& name, SaveableGroup* group, bool defaultValue)
26  : QCheckBox(QString().fromStdString(name)), Saveable(name, group, defaultValue)
27  {
28    //this->load(this->value());
29  }
30
31  void QtGuiCheckBox::load()
32  {
33    Saveable::load();
34    if (this->value().getBool())
35      this->setCheckState(Qt::Checked);
36    else
37      this->setCheckState(Qt::Unchecked);
38  }
39
40
41
42  void QtGuiCheckBox::save()
43  {
44    this->value() = this->checkState();
45    Saveable::save();
46  }
47
48
49
50
51
52  QtGuiSlider::QtGuiSlider(const std::string& name, SaveableGroup* group, int defaultValue, Qt::Orientation orientation)
53  : QSlider(orientation), Saveable(name, group, defaultValue)
54  {
55
56  }
57
58  QtGuiSlider::~QtGuiSlider()
59  {}
60
61  void QtGuiSlider::load()
62  {
63    Saveable::load();
64    this->setValue(this->Saveable::value().getInt());
65  }
66
67  void QtGuiSlider::save()
68  {
69    this->Saveable::value() = this->QSlider::value();
70    Saveable::save();
71  }
72
73
74
75
76
77
78
79  QtGuiComboBox::QtGuiComboBox(const std::string& name, SaveableGroup* group, const std::string& defaultValue)
80  : QComboBox(), Saveable(name, group, defaultValue)
81  {
82
83
84  }
85
86  void QtGuiComboBox::load()
87  {
88    Saveable::load();
89    int index = this->findText(QString().fromStdString(this->value().getString()));
90    if (index == -1)
91      index = 1;
92    this->setCurrentIndex(index);
93  }
94
95  void QtGuiComboBox::save()
96  {
97    this->value() = this->currentText().toStdString();
98    Saveable::save();
99  }
100
101
102  QtGuiInputLine::QtGuiInputLine(const std::string& name, SaveableGroup* group, const std::string& defaultValue)
103  : QLineEdit(), Saveable(name, group, defaultValue)
104  {
105
106
107  }
108
109
110  void QtGuiInputLine::load()
111  {
112    Saveable::load();
113    this->setText(QString().fromStdString(this->value().getString()));
114  }
115
116
117
118  void QtGuiInputLine::save()
119  {
120    this->value() = this->text().toStdString();
121    Saveable::save();
122  }
123
124
125
126
127}
Note: See TracBrowser for help on using the repository browser.