Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/qt_gui/qt_gui_elements.cc @ 8140

Last change on this file since 8140 was 7661, checked in by bensch, 18 years ago

orxonox/trunk: merged the QT_GUI back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/qt_gui . -r7607:HEAD

absolutely no conflicts :)

File size: 2.3 KB
RevLine 
[4744]1/*
[1853]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.
[1855]10
11   ### File Specific:
[7149]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[3955]16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
[1853]17
[7539]18#include "qt_gui_elements.h"
[1853]19
[7447]20namespace OrxGui
21{
[1853]22
[7447]23
24
[7555]25  QtGuiCheckBox::QtGuiCheckBox(const std::string& name, SaveableGroup* group, bool defaultValue)
[7632]26  : QCheckBox(QString().fromStdString(name)), Saveable(name, group, defaultValue)
[7539]27  {
28    //this->load(this->value());
29  }
[7531]30
[7598]31  void QtGuiCheckBox::load()
[7539]32  {
[7598]33    Saveable::load();
34    if (this->value().getBool())
35      this->setCheckState(Qt::Checked);
36    else
37      this->setCheckState(Qt::Unchecked);
[7539]38  }
[7531]39
[7539]40
41
[7598]42  void QtGuiCheckBox::save()
[7531]43  {
[7599]44    this->value() = this->checkState();
45    Saveable::save();
[7539]46  }
[7531]47
[7549]48
49
50
51
[7632]52  QtGuiSlider::QtGuiSlider(const std::string& name, SaveableGroup* group, int defaultValue, Qt::Orientation orientation)
53  : QSlider(orientation), Saveable(name, group, defaultValue)
[7549]54  {
55
56  }
[7599]57
[7549]58  QtGuiSlider::~QtGuiSlider()
59  {}
60
[7599]61  void QtGuiSlider::load()
62  {
63    Saveable::load();
64    this->setValue(this->Saveable::value().getInt());
65  }
[7549]66
[7599]67  void QtGuiSlider::save()
68  {
69    this->Saveable::value() = this->QSlider::value();
70    Saveable::save();
71  }
[7549]72
73
74
75
76
77
[7599]78
[7632]79  QtGuiComboBox::QtGuiComboBox(const std::string& name, SaveableGroup* group, const std::string& defaultValue)
80  : QComboBox(), Saveable(name, group, defaultValue)
[7539]81  {
[7531]82
[7539]83
[7531]84  }
85
[7598]86  void QtGuiComboBox::load()
[7539]87  {
[7601]88    Saveable::load();
[7639]89    int index = this->findText(QString().fromStdString(this->value().getString()));
90    if (index == -1)
91      index = 1;
92    this->setCurrentIndex(index);
[7539]93  }
[7531]94
[7598]95  void QtGuiComboBox::save()
[7539]96  {
[7601]97    this->value() = this->currentText().toStdString();
98    Saveable::save();
[7539]99  }
[7531]100
[7539]101
[7632]102  QtGuiInputLine::QtGuiInputLine(const std::string& name, SaveableGroup* group, const std::string& defaultValue)
103  : QLineEdit(), Saveable(name, group, defaultValue)
[7585]104  {
105
106
107  }
108
109
[7598]110  void QtGuiInputLine::load()
[7585]111  {
[7603]112    Saveable::load();
113    this->setText(QString().fromStdString(this->value().getString()));
[7585]114  }
115
116
117
[7598]118  void QtGuiInputLine::save()
[7585]119  {
[7603]120    this->value() = this->text().toStdString();
121    Saveable::save();
[7585]122  }
123
124
125
126
[7447]127}
Note: See TracBrowser for help on using the repository browser.