src/gui/text/qtextdocument.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   125             for (int i = open+1; i < close; ++i) {
   125             for (int i = open+1; i < close; ++i) {
   126                 if (text[i].isDigit() || text[i].isLetter())
   126                 if (text[i].isDigit() || text[i].isLetter())
   127                     tag += text[i];
   127                     tag += text[i];
   128                 else if (!tag.isEmpty() && text[i].isSpace())
   128                 else if (!tag.isEmpty() && text[i].isSpace())
   129                     break;
   129                     break;
       
   130                 else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close)
       
   131                     break;
   130                 else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
   132                 else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
   131                     return false; // that's not a tag
   133                     return false; // that's not a tag
   132             }
   134             }
   133 #ifndef QT_NO_TEXTHTMLPARSER
   135 #ifndef QT_NO_TEXTHTMLPARSER
   134             return QTextHtmlParser::lookupElement(tag.toLower()) != -1;
   136             return QTextHtmlParser::lookupElement(tag.toLower()) != -1;
   579     again.
   581     again.
   580 */
   582 */
   581 void QTextDocument::markContentsDirty(int from, int length)
   583 void QTextDocument::markContentsDirty(int from, int length)
   582 {
   584 {
   583     Q_D(QTextDocument);
   585     Q_D(QTextDocument);
   584     if (!d->inContentsChange)
       
   585         d->beginEditBlock();
       
   586     d->documentChange(from, length);
   586     d->documentChange(from, length);
   587     if (!d->inContentsChange)
   587     if (!d->inContentsChange) {
   588         d->endEditBlock();
   588         d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength);
       
   589         d->docChangeFrom = -1;
       
   590     }
   589 }
   591 }
   590 
   592 
   591 /*!
   593 /*!
   592     \property QTextDocument::useDesignMetrics
   594     \property QTextDocument::useDesignMetrics
   593     \since 4.1
   595     \since 4.1
  2494 void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
  2496 void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
  2495 {
  2497 {
  2496     QTextBlockFormat format = block.blockFormat();
  2498     QTextBlockFormat format = block.blockFormat();
  2497     emitAlignment(format.alignment());
  2499     emitAlignment(format.alignment());
  2498 
  2500 
  2499     Qt::LayoutDirection dir = format.layoutDirection();
  2501     // assume default to not bloat the html too much
  2500     if (dir == Qt::LeftToRight) {
  2502     // html += QLatin1String(" dir='ltr'");
  2501         // assume default to not bloat the html too much
  2503     if (block.textDirection() == Qt::RightToLeft)
  2502         // html += QLatin1String(" dir='ltr'");
       
  2503     } else {
       
  2504         html += QLatin1String(" dir='rtl'");
  2504         html += QLatin1String(" dir='rtl'");
  2505     }
       
  2506 
  2505 
  2507     QLatin1String style(" style=\"");
  2506     QLatin1String style(" style=\"");
  2508     html += style;
  2507     html += style;
  2509 
  2508 
  2510     const bool emptyBlock = block.begin().atEnd();
  2509     const bool emptyBlock = block.begin().atEnd();