diff --git a/doc/src/projects/creator-projects-custom-wizards.qdoc b/doc/src/projects/creator-projects-custom-wizards.qdoc index 09021ab7dde..591c85a25fc 100644 --- a/doc/src/projects/creator-projects-custom-wizards.qdoc +++ b/doc/src/projects/creator-projects-custom-wizards.qdoc @@ -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 diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp index 5e4f2217854..11da62e991c 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp @@ -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));