summaryrefslogtreecommitdiff
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 11:28:37 +0100
commita7d61534acdb90b925d7f250665dcd30c3f37668 (patch)
tree4585904081b5bf9ef52aaedd8f1df92abeb03e4a
parent6863ce4e3582745ad683df646746fe23a8e21592 (diff)
downloadqttools-a7d61534acdb90b925d7f250665dcd30c3f37668.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>
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index d8a7a7c6c..406037993 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/src/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 <QtWidgets/QAction>
#include <QtWidgets/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())