From 5f0c513f919a8d0a539fca4b5eb50ce125af8514 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 18 Jan 2013 16:39:33 +0100 Subject: Qt Designer: Use multiline validation for dynamic string properties. Task-number: QTBUG-26394 Change-Id: Idbaa4bad71125b74d8407bb56ee9fdbf83831fe0 Reviewed-by: Jarek Kobus (cherry picked from qttools/a7d61534acdb90b925d7f250665dcd30c3f37668) --- .../src/lib/shared/qdesigner_propertyeditor.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 +#include +#include +#include #include #include #include @@ -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(core->extensionManager(), object)) { + if (dynamicSheet->dynamicPropertiesAllowed()) { + if (QDesignerPropertySheetExtension *propertySheet = qt_extension(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(object), propertyName)) + return StringPropertyParameters(ValidationMultiLine, true); + // Check hardcoded property ames const PropertyNameTypeMap::const_iterator hit = stringPropertyTypes().constFind(propertyName); if (hit != stringPropertyTypes().constEnd()) -- cgit v0.12