OpenWalnut  1.5.0dev
WPropertyMatrix4X4Widget.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WPROPERTYMATRIX4X4WIDGET_H
26 #define WPROPERTYMATRIX4X4WIDGET_H
27 
28 #include <string>
29 
30 #include <QLineEdit>
31 #include <QSlider>
32 #include <QHBoxLayout>
33 
34 #include "../guiElements/WScaleLabel.h"
35 
36 #include "WPropertyWidget.h"
37 
38 class WScaleLabel;
39 
40 /**
41  * Implements a property widget for MATRIX4X4.
42  */
44 {
45  Q_OBJECT
46 public:
47  /**
48  * Constructor. Creates a new widget appropriate for the specified property.
49  *
50  * \param property the property to handle
51  * \param parent the parent widget.
52  * \param propertyGrid the grid used to layout the labels and property widgets
53  */
54  WPropertyMatrix4X4Widget( WPropMatrix4X4 property, QGridLayout* propertyGrid, QWidget* parent = 0 );
55 
56  /**
57  * Destructor.
58  */
59  virtual ~WPropertyMatrix4X4Widget();
60 
61 protected:
62  /**
63  * Called whenever the widget should update.
64  */
65  virtual void update();
66 
67  /**
68  * The integer property represented by this widget.
69  */
70  WPropMatrix4X4 m_matrixProperty;
71 
72  /**
73  * The edit field showing the value of the slider
74  */
75  QLineEdit m_edits[16];
76 
77  /**
78  * Layout used to position the label and the widgets
79  */
80  QVBoxLayout m_layout;
81 
82  /**
83  * Used to show the property as text.
84  */
86 
87  /**
88  * The layout used for the pure output (information properties)
89  */
90  QHBoxLayout m_infoLayout;
91 
92  /**
93  * Updates the property using the edit X Y and Z widgets.
94  *
95  * \param validateOnly true if the prop should not really be set. Just validated.
96  */
97  void setPropertyFromWidgets( bool validateOnly = false );
98 
99 private:
100 public slots:
101 
102  /**
103  * Called whenever the edit field changes
104  */
105  void editChanged();
106 
107  /**
108  * Called when the text in m_edit changes.
109  *
110  * \param text
111  */
112  void textEdited( const QString& text );
113 };
114 
115 #endif // WPROPERTYMATRIX4X4WIDGET_H
116 
Implements a property widget for MATRIX4X4.
WPropMatrix4X4 m_matrixProperty
The integer property represented by this widget.
QVBoxLayout m_layout
Layout used to position the label and the widgets.
void editChanged()
Called whenever the edit field changes.
QHBoxLayout m_infoLayout
The layout used for the pure output (information properties)
void setPropertyFromWidgets(bool validateOnly=false)
Updates the property using the edit X Y and Z widgets.
WScaleLabel m_asText
Used to show the property as text.
void textEdited(const QString &text)
Called when the text in m_edit changes.
virtual void update()
Called whenever the widget should update.
WPropertyMatrix4X4Widget(WPropMatrix4X4 property, QGridLayout *propertyGrid, QWidget *parent=0)
Constructor.
virtual ~WPropertyMatrix4X4Widget()
Destructor.
QLineEdit m_edits[16]
The edit field showing the value of the slider.
Class building the base for all widgets representing properties.
Special Label that can shrink and expand in a layout.
Definition: WScaleLabel.h:37