forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user