DataFieldWidget.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::Gui
17 * @author Kai Welke (welke@kit.edu)
18 * @copyright 2012 Humanoids Group, IAIM, IFA
19 * @license http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #include "DataFieldWidget.h"
24 
25 namespace armarx
26 {
27  DataFieldWidget::DataFieldWidget(DataFieldIdentifierPtr dataFieldIdentifier, VariantPtr variant, QWidget* parent, Qt::WindowFlags f)
28  : QWidget(parent, f)
29  {
30  this->variant = variant;
31  this->dataFieldIdentifier = dataFieldIdentifier;
32 
33  enableEdit = true;
34  variantWidget = NULL;
35 
36  label = new QLabel(this);
37  label->setGeometry(5, 0, 600, 25);
38  label->setText((dataFieldIdentifier->getIdentifierStr() + " = ").c_str());
39  label->setWordWrap(false);
40  label->adjustSize();
41  label->setTextInteractionFlags(Qt::TextSelectableByMouse);
42  setupLayout();
43  }
44 
45  void DataFieldWidget::setEnableEdit(bool enableEdit)
46  {
47  this->enableEdit = enableEdit;
48  setupLayout();
49  }
50 
51 
53  {
54  return enableEdit;
55  }
56 
57 
58  void DataFieldWidget::setupLayout()
59  {
60  if (variantWidget)
61  {
62  delete variantWidget;
63  }
64 
65  variantWidget = new VariantWidget(variant, this);
66  variantWidget->setGeometry(label->width() + 5 + 5, 0, 430, 200);
67  variantWidget->setEnableEdit(enableEdit);
68  variantWidget->show();
69  }
70 }
armarx::DataFieldWidget::DataFieldWidget
DataFieldWidget(DataFieldIdentifierPtr dataFieldIdentifier, VariantPtr variant, QWidget *parent=0, Qt::WindowFlags f=0)
Definition: DataFieldWidget.cpp:27
DataFieldWidget.h
armarx::DataFieldWidget::setEnableEdit
void setEnableEdit(bool enableEdit)
Definition: DataFieldWidget.cpp:45
IceInternal::Handle< DataFieldIdentifier >
armarx::DataFieldWidget::getEnableEdit
bool getEnableEdit()
Definition: DataFieldWidget.cpp:52
armarx::VariantWidget::setEnableEdit
void setEnableEdit(bool enableEdit)
Definition: VariantWidget.cpp:105
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28