OpenWalnut  1.5.0dev
WPropertyStringWidget.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 WPROPERTYSTRINGWIDGET_H
26 #define WPROPERTYSTRINGWIDGET_H
27 
28 #include <string>
29 
30 #include <QLineEdit>
31 #include <QSlider>
32 #include <QHBoxLayout>
33 
34 #include "../guiElements/WScaleLabel.h"
35 #include "WPropertyWidget.h"
36 
37 /**
38  * Implements a property widget for WPropString.
39  */
41 {
42  Q_OBJECT
43 public:
44  /**
45  * Constructor. Creates a new widget appropriate for the specified property.
46  *
47  * \param property the property to handle
48  * \param parent the parent widget.
49  * \param propertyGrid the grid used to layout the labels and property widgets
50  */
51  WPropertyStringWidget( WPropString property, QGridLayout* propertyGrid, QWidget* parent = 0 );
52 
53  /**
54  * Destructor.
55  */
56  virtual ~WPropertyStringWidget();
57 
58  /**
59  * Disable the ability to select text. This is only applicable if in information mode.
60  *
61  * \param disable true to disable.
62  */
63  void disableTextInteraction( bool disable = true );
64 
65 protected:
66  /**
67  * Called whenever the widget should update.
68  */
69  virtual void update();
70 
71  /**
72  * The integer property represented by this widget.
73  */
74  WPropString m_stringProperty;
75 
76  /**
77  * The edit field showing the value
78  */
79  QLineEdit m_edit;
80 
81  /**
82  * Layout used to position the label and the checkbox
83  */
84  QHBoxLayout m_layout;
85 
86  /**
87  * Used to show the property as text.
88  */
90 
91  /**
92  * The layout used for the pure output (information properties)
93  */
94  QHBoxLayout m_infoLayout;
95 
96 private:
97 public slots:
98 
99  /**
100  * Called whenever the edit field changes
101  */
102  void editChanged();
103 
104  /**
105  * Called when the text in m_edit changes.
106  *
107  * \param text
108  */
109  void textEdited( const QString& text );
110 };
111 
112 #endif // WPROPERTYSTRINGWIDGET_H
113 
Implements a property widget for WPropString.
void disableTextInteraction(bool disable=true)
Disable the ability to select text.
QHBoxLayout m_infoLayout
The layout used for the pure output (information properties)
void editChanged()
Called whenever the edit field changes.
WPropString m_stringProperty
The integer property represented by this widget.
void textEdited(const QString &text)
Called when the text in m_edit changes.
QLineEdit m_edit
The edit field showing the value.
virtual ~WPropertyStringWidget()
Destructor.
WScaleLabel m_asText
Used to show the property as text.
QHBoxLayout m_layout
Layout used to position the label and the checkbox.
WPropertyStringWidget(WPropString property, QGridLayout *propertyGrid, QWidget *parent=0)
Constructor.
virtual void update()
Called whenever the widget should update.
Class building the base for all widgets representing properties.
Special Label that can shrink and expand in a layout.
Definition: WScaleLabel.h:37