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
25namespace armarx
26{
28 VariantPtr variant,
29 QWidget* parent,
30 Qt::WindowFlags f) :
31 QWidget(parent, f)
32 {
33 this->variant = variant;
34 this->dataFieldIdentifier = dataFieldIdentifier;
35
36 enableEdit = true;
37 variantWidget = NULL;
38
39 label = new QLabel(this);
40 label->setGeometry(5, 0, 600, 25);
41 label->setText((dataFieldIdentifier->getIdentifierStr() + " = ").c_str());
42 label->setWordWrap(false);
43 label->adjustSize();
44 label->setTextInteractionFlags(Qt::TextSelectableByMouse);
45 setupLayout();
46 }
47
48 void
50 {
51 this->enableEdit = enableEdit;
52 setupLayout();
53 }
54
55 bool
57 {
58 return enableEdit;
59 }
60
61 void
62 DataFieldWidget::setupLayout()
63 {
64 if (variantWidget)
65 {
66 delete variantWidget;
67 }
68
69 variantWidget = new VariantWidget(variant, this);
70 variantWidget->setGeometry(label->width() + 5 + 5, 0, 430, 200);
71 variantWidget->setEnableEdit(enableEdit);
72 variantWidget->show();
73 }
74} // namespace armarx
void setEnableEdit(bool enableEdit)
DataFieldWidget(DataFieldIdentifierPtr dataFieldIdentifier, VariantPtr variant, QWidget *parent=0, Qt::WindowFlags f=0)
void setEnableEdit(bool enableEdit)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Variant > VariantPtr
Definition Variant.h:41
IceInternal::Handle< DataFieldIdentifier > DataFieldIdentifierPtr
Typedef of DataFieldIdentifierPtr as IceInternal::Handle<DataFieldIdentifier> for convenience.