**
****************************************************************************/
-#include "qsgtextnode_p.h"
+#include "qquicktextnode_p.h"
#include "qsgsimplerectnode.h"
#include <private/qsgadaptationlayer_p.h>
#include <private/qsgdistancefieldglyphcache_p.h>
QT_BEGIN_NAMESPACE
/*!
- Creates an empty QSGTextNode
+ Creates an empty QQuickTextNode
*/
-QSGTextNode::QSGTextNode(QSGContext *context)
+QQuickTextNode::QQuickTextNode(QSGContext *context)
: m_context(context), m_cursorNode(0)
{
#if defined(QML_RUNTIME_TESTING)
#endif
}
-QSGTextNode::~QSGTextNode()
+QQuickTextNode::~QQuickTextNode()
{
qDeleteAll(m_textures);
}
#if 0
-void QSGTextNode::setColor(const QColor &color)
+void QQuickTextNode::setColor(const QColor &color)
{
if (m_usePixmapCache) {
setUpdateFlag(UpdateNodes);
m_color = color;
}
-void QSGTextNode::setStyleColor(const QColor &styleColor)
+void QQuickTextNode::setStyleColor(const QColor &styleColor)
{
- if (m_textStyle != QSGTextNode::NormalTextStyle) {
+ if (m_textStyle != QQuickTextNode::NormalTextStyle) {
if (m_usePixmapCache) {
setUpdateFlag(UpdateNodes);
} else {
}
#endif
-QSGGlyphNode *QSGTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
- QSGText::TextStyle style, const QColor &styleColor,
+QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
+ QQuickText::TextStyle style, const QColor &styleColor,
QSGNode *parentNode)
{
QSGGlyphNode *node = m_context->createGlyphNode();
return node;
}
-void QSGTextNode::setCursor(const QRectF &rect, const QColor &color)
+void QQuickTextNode::setCursor(const QRectF &rect, const QColor &color)
{
if (m_cursorNode != 0)
delete m_cursorNode;
BinaryTreeNode()
: selectionState(Unselected)
, clipNode(0)
- , decorations(QSGTextNode::NoDecoration)
+ , decorations(QQuickTextNode::NoDecoration)
, ascent(0.0)
, leftChildIndex(-1)
, rightChildIndex(-1)
: boundingRect(brect)
, selectionState(selState)
, clipNode(0)
- , decorations(QSGTextNode::NoDecoration)
+ , decorations(QQuickTextNode::NoDecoration)
, image(i)
, ascent(a)
, leftChildIndex(-1)
}
BinaryTreeNode(const QGlyphRun &g, SelectionState selState, const QRectF &brect,
- const QSGTextNode::Decorations &decs, const QColor &c, const QColor &bc,
+ const QQuickTextNode::Decorations &decs, const QColor &c, const QColor &bc,
const QPointF &pos, qreal a)
: glyphRun(g)
, boundingRect(brect)
QRectF boundingRect;
SelectionState selectionState;
QSGClipNode *clipNode;
- QSGTextNode::Decorations decorations;
+ QQuickTextNode::Decorations decorations;
QColor color;
QColor backgroundColor;
QPointF position;
if (qFuzzyIsNull(searchRect.width()) || qFuzzyIsNull(searchRect.height()))
return;
- QSGTextNode::Decorations decorations = QSGTextNode::NoDecoration;
- decorations |= (glyphRun.underline() ? QSGTextNode::Underline : QSGTextNode::NoDecoration);
- decorations |= (glyphRun.overline() ? QSGTextNode::Overline : QSGTextNode::NoDecoration);
- decorations |= (glyphRun.strikeOut() ? QSGTextNode::StrikeOut : QSGTextNode::NoDecoration);
- decorations |= (backgroundColor.isValid() ? QSGTextNode::Background : QSGTextNode::NoDecoration);
+ QQuickTextNode::Decorations decorations = QQuickTextNode::NoDecoration;
+ decorations |= (glyphRun.underline() ? QQuickTextNode::Underline : QQuickTextNode::NoDecoration);
+ decorations |= (glyphRun.overline() ? QQuickTextNode::Overline : QQuickTextNode::NoDecoration);
+ decorations |= (glyphRun.strikeOut() ? QQuickTextNode::StrikeOut : QQuickTextNode::NoDecoration);
+ decorations |= (backgroundColor.isValid() ? QQuickTextNode::Background : QQuickTextNode::NoDecoration);
qreal ascent = glyphRun.rawFont().ascent();
insert(binaryTree, BinaryTreeNode(glyphRun, selectionState, searchRect, decorations,
int start, int end,
int selectionStart, int selectionEnd);
- void addToSceneGraph(QSGTextNode *parent,
- QSGText::TextStyle style = QSGText::Normal,
+ void addToSceneGraph(QQuickTextNode *parent,
+ QQuickText::TextStyle style = QQuickText::Normal,
const QColor &styleColor = QColor());
void setSelectionColor(const QColor &selectionColor)
BinaryTreeNode::SelectionState currentSelectionState = BinaryTreeNode::Unselected;
QRectF currentRect;
- QSGTextNode::Decorations currentDecorations = QSGTextNode::NoDecoration;
+ QQuickTextNode::Decorations currentDecorations = QQuickTextNode::NoDecoration;
qreal underlineOffset = 0.0;
qreal underlineThickness = 0.0;
currentSelectionState = node->selectionState;
// Update decorations
- if (currentDecorations != QSGTextNode::NoDecoration) {
+ if (currentDecorations != QQuickTextNode::NoDecoration) {
decorationRect.setY(m_position.y() + m_currentLine.y());
decorationRect.setHeight(m_currentLine.height());
decorationRect.setRight(node->boundingRect.left());
TextDecoration textDecoration(currentSelectionState, decorationRect, lastColor);
- if (currentDecorations & QSGTextNode::Underline)
+ if (currentDecorations & QQuickTextNode::Underline)
pendingUnderlines.append(textDecoration);
- if (currentDecorations & QSGTextNode::Overline)
+ if (currentDecorations & QQuickTextNode::Overline)
pendingOverlines.append(textDecoration);
- if (currentDecorations & QSGTextNode::StrikeOut)
+ if (currentDecorations & QQuickTextNode::StrikeOut)
pendingStrikeOuts.append(textDecoration);
- if (currentDecorations & QSGTextNode::Background)
+ if (currentDecorations & QQuickTextNode::Background)
m_backgrounds.append(qMakePair(decorationRect, lastBackgroundColor));
}
// If previous item(s) had underline and current does not, then we add the
// pending lines to the lists and likewise for overlines and strikeouts
if (!pendingUnderlines.isEmpty()
- && !(node->decorations & QSGTextNode::Underline)) {
+ && !(node->decorations & QQuickTextNode::Underline)) {
addTextDecorations(pendingUnderlines, underlineOffset, underlineThickness);
pendingUnderlines.clear();
// Merge current values with previous. Prefer greatest thickness
QRawFont rawFont = node->glyphRun.rawFont();
- if (node->decorations & QSGTextNode::Underline) {
+ if (node->decorations & QQuickTextNode::Underline) {
if (rawFont.lineThickness() > underlineThickness) {
underlineThickness = rawFont.lineThickness();
underlineOffset = rawFont.underlinePosition();
}
}
- if (node->decorations & QSGTextNode::Overline) {
+ if (node->decorations & QQuickTextNode::Overline) {
overlineOffset = -rawFont.ascent();
overlineThickness = rawFont.lineThickness();
}
- if (node->decorations & QSGTextNode::StrikeOut) {
+ if (node->decorations & QQuickTextNode::StrikeOut) {
strikeOutThickness = rawFont.lineThickness();
strikeOutOffset = rawFont.ascent() / -3.0;
}
}
}
- void SelectionEngine::addToSceneGraph(QSGTextNode *parentNode,
- QSGText::TextStyle style,
+ void SelectionEngine::addToSceneGraph(QQuickTextNode *parentNode,
+ QQuickText::TextStyle style,
const QColor &styleColor)
{
if (m_currentLine.isValid())
}
}
-void QSGTextNode::mergeFormats(QTextLayout *textLayout,
+void QQuickTextNode::mergeFormats(QTextLayout *textLayout,
QVarLengthArray<QTextLayout::FormatRange> *mergedFormats)
{
Q_ASSERT(mergedFormats != 0);
}
-void QSGTextNode::addImage(const QRectF &rect, const QImage &image)
+void QQuickTextNode::addImage(const QRectF &rect, const QImage &image)
{
QSGImageNode *node = m_context->createImageNode();
QSGTexture *texture = m_context->createTexture(image);
node->update();
}
-void QSGTextNode::addTextDocument(const QPointF &, QTextDocument *textDocument,
+void QQuickTextNode::addTextDocument(const QPointF &, QTextDocument *textDocument,
const QColor &textColor,
- QSGText::TextStyle style, const QColor &styleColor,
+ QQuickText::TextStyle style, const QColor &styleColor,
const QColor &selectionColor, const QColor &selectedTextColor,
int selectionStart, int selectionEnd)
{
engine.addToSceneGraph(this, style, styleColor);
}
-void QSGTextNode::addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color,
- QSGText::TextStyle style, const QColor &styleColor,
+void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color,
+ QQuickText::TextStyle style, const QColor &styleColor,
const QColor &selectionColor, const QColor &selectedTextColor,
int selectionStart, int selectionEnd)
{
engine.addToSceneGraph(this, style, styleColor);
}
-void QSGTextNode::deleteContent()
+void QQuickTextNode::deleteContent()
{
while (firstChild() != 0)
delete firstChild();
}
#if 0
-void QSGTextNode::updateNodes()
+void QQuickTextNode::updateNodes()
{
return;
deleteContent();