summaryrefslogtreecommitdiffstats
path: root/qtpropertybrowser/src/qtpropertybrowser.cpp
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@nokia.com>2011-05-27 14:55:12 +0200
committerChristian Strømme <christian.stromme@nokia.com>2011-06-03 12:11:13 +0200
commit4d0c295cfe31ee765b5019442dd1554839f7a766 (patch)
tree0a3d1fb8191dafe5578c8561c6fc64a2ccf242f5 /qtpropertybrowser/src/qtpropertybrowser.cpp
parent3d5fac039b8c23ca883b0363b4c9990b639bfa24 (diff)
Added functionality to set the echo-mode on string properties (QLineEdit editor).
Reviewed-by: Martin Pejcoch
Diffstat (limited to 'qtpropertybrowser/src/qtpropertybrowser.cpp')
-rw-r--r--qtpropertybrowser/src/qtpropertybrowser.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/qtpropertybrowser/src/qtpropertybrowser.cpp b/qtpropertybrowser/src/qtpropertybrowser.cpp
index bfa5705..8fccc51 100644
--- a/qtpropertybrowser/src/qtpropertybrowser.cpp
+++ b/qtpropertybrowser/src/qtpropertybrowser.cpp
@@ -42,6 +42,7 @@
#include <QtCore/QSet>
#include <QtCore/QMap>
#include <QtGui/QIcon>
+#include <QtGui/QLineEdit>
#if defined(Q_CC_MSVC)
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
@@ -54,7 +55,10 @@ QT_BEGIN_NAMESPACE
class QtPropertyPrivate
{
public:
- QtPropertyPrivate(QtAbstractPropertyManager *manager) : m_enabled(true), m_modified(false), m_manager(manager) {}
+ QtPropertyPrivate(QtAbstractPropertyManager *manager)
+ : m_enabled(true),
+ m_modified(false),
+ m_manager(manager) {}
QtProperty *q_ptr;
QSet<QtProperty *> m_parentItems;
@@ -296,6 +300,19 @@ QString QtProperty::valueText() const
}
/*!
+ Returns the display text according to the echo-mode set on the editor.
+
+ When the editor is a QLineEdit, this will return a string equal to what
+ is displayed.
+
+ \sa QtAbstractPropertyManager::valueText()
+*/
+QString QtProperty::displayText() const
+{
+ return d_ptr->m_manager->displayText(this);
+}
+
+/*!
Sets the property's tool tip to the given \a text.
\sa toolTip()
@@ -718,6 +735,35 @@ QString QtAbstractPropertyManager::valueText(const QtProperty *property) const
}
/*!
+ Returns a string representing the current state of the given \a
+ property.
+
+ The default implementation of this function returns an empty
+ string.
+
+ \sa QtProperty::valueText()
+*/
+QString QtAbstractPropertyManager::displayText(const QtProperty *property) const
+{
+ Q_UNUSED(property)
+ return QString();
+}
+
+/*!
+ Returns the echo mode representing the current state of the given \a
+ property.
+
+ The default implementation of this function returns QLineEdit::Normal.
+
+ \sa QtProperty::valueText()
+*/
+EchoMode QtAbstractPropertyManager::echoMode(const QtProperty *property) const
+{
+ Q_UNUSED(property)
+ return QLineEdit::Normal;
+}
+
+/*!
Creates a property with the given \a name which then is owned by this manager.
Internally, this function calls the createProperty() and