Custom wizard: Introduce acceptRichText-property for QTextEdit.

Defaults to false (as opposed to QTextEdit's default) to
suppress formatting when pasting code from bugtrackers, etc.

Change-Id: Ib3dddd1424e56edef48bc63fb13d6c22e18a815c
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Friedemann Kleint
2013-04-11 10:10:14 +02:00
parent e3fde349ad
commit a6112ffc4e
2 changed files with 9 additions and 0 deletions

View File

@@ -466,6 +466,11 @@
The \c defaulttext attribute specifies text that appears in the field by default.
The property QTextEdit::acceptRichText can be set by using the boolean
attribute \c acceptRichText. It is disabled by default (as opposed to the default
value of QTextEdit::acceptRichText) to prevent pasting of rich text with formatting,
which is not desireable for code templates.
\section1 Processing Template Files
When processing a template source file, placeholders specifying the field

View File

@@ -301,6 +301,10 @@ QWidget *CustomWizardFieldPage::registerTextEdit(const QString &fieldName,
const CustomWizardField &field)
{
QTextEdit *textEdit = new QTextEdit;
// Suppress formatting by default (inverting QTextEdit's default value) when
// pasting from Bug tracker, etc.
const bool acceptRichText = field.controlAttributes.value(QLatin1String("acceptRichText")) == QLatin1String("true");
textEdit->setAcceptRichText(acceptRichText);
registerField(fieldName, textEdit, "plainText", SIGNAL(textChanged(QString)));
const QString defaultText = field.controlAttributes.value(QLatin1String("defaulttext"));
m_textEdits.push_back(TextEditData(textEdit, defaultText));