summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-01-18 15:39:33 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-21 16:33:44 (GMT)
commit5f0c513f919a8d0a539fca4b5eb50ce125af8514 (patch)
tree826ddb21a031b66df517b75d54384ae4ff6c5c32 /tools
parent22fdb0300eafc8b0129850af0398fbed1ba59d29 (diff)
downloadQt-5f0c513f919a8d0a539fca4b5eb50ce125af8514.zip
Qt-5f0c513f919a8d0a539fca4b5eb50ce125af8514.tar.gz
Qt-5f0c513f919a8d0a539fca4b5eb50ce125af8514.tar.bz2
Qt Designer: Use multiline validation for dynamic string properties.
Task-number: QTBUG-26394 Change-Id: Idbaa4bad71125b74d8407bb56ee9fdbf83831fe0 Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com> (cherry picked from qttools/a7d61534acdb90b925d7f250665dcd30c3f37668)
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index 5752c7e..5405be5 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
@@ -43,6 +43,9 @@
#include "pluginmanager_p.h"
#include <QtDesigner/QDesignerFormEditorInterface>
+#include <QtDesigner/QDesignerDynamicPropertySheetExtension>
+#include <QtDesigner/QDesignerPropertySheetExtension>
+#include <QtDesigner/QExtensionManager>
#include <widgetfactory_p.h>
#include <QtGui/QAction>
#include <QtGui/QLineEdit>
@@ -99,6 +102,20 @@ QDesignerPropertyEditor::QDesignerPropertyEditor(QWidget *parent, Qt::WindowFlag
connect(this, SIGNAL(propertyChanged(QString,QVariant)), this, SLOT(slotPropertyChanged(QString,QVariant)));
}
+static inline bool isDynamicProperty(QDesignerFormEditorInterface *core, QObject *object,
+ const QString &propertyName)
+{
+ if (const QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), object)) {
+ if (dynamicSheet->dynamicPropertiesAllowed()) {
+ if (QDesignerPropertySheetExtension *propertySheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), object)) {
+ const int index = propertySheet->indexOf(propertyName);
+ return index >= 0 && dynamicSheet->isDynamicProperty(index);
+ }
+ }
+ }
+ return false;
+}
+
QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textPropertyValidationMode(
QDesignerFormEditorInterface *core, const QObject *object,
const QString &propertyName, bool isMainContainer)
@@ -118,6 +135,9 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
return customType;
}
+ if (isDynamicProperty(core, const_cast<QObject *>(object), propertyName))
+ return StringPropertyParameters(ValidationMultiLine, true);
+
// Check hardcoded property ames
const PropertyNameTypeMap::const_iterator hit = stringPropertyTypes().constFind(propertyName);
if (hit != stringPropertyTypes().constEnd())