summaryrefslogtreecommitdiff
path: root/tools/designer
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-01-18 16:39:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-21 17:33:44 +0100
commit5f0c513f919a8d0a539fca4b5eb50ce125af8514 (patch)
tree826ddb21a031b66df517b75d54384ae4ff6c5c32 /tools/designer
parent22fdb0300eafc8b0129850af0398fbed1ba59d29 (diff)
downloadqt4-tools-5f0c513f919a8d0a539fca4b5eb50ce125af8514.tar.gz
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/designer')
-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 5752c7e5ed..5405be52df 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())