2017-07-21 18:21:34 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskTextNode.h"
|
|
|
|
#include "QskTextOptions.h"
|
|
|
|
|
|
|
|
#include <QFont>
|
2017-10-20 15:29:50 +02:00
|
|
|
#include <QColor>
|
2017-07-21 18:21:34 +02:00
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
QskTextNode::QskTextNode():
|
|
|
|
m_hash( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QskTextNode::~QskTextNode()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QskTextNode::setTextData(
|
|
|
|
const QString& text, const QSizeF& size, const QFont& font,
|
|
|
|
const QskTextOptions& options, Qt::Alignment alignment, Qsk::TextStyle textStyle,
|
2017-10-17 17:34:00 +02:00
|
|
|
const QColor& textColor, const QColor& styleColor, const QColor& linkColor )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
uint hash;
|
|
|
|
|
|
|
|
hash = qHash( text, 0 );
|
|
|
|
hash = qHash( font, hash );
|
|
|
|
hash = qHash( options, hash );
|
|
|
|
hash = qHash( alignment, hash );
|
|
|
|
hash = qHash( textStyle, hash );
|
|
|
|
hash = qHash( textColor.rgba(), hash );
|
|
|
|
hash = qHash( styleColor.rgba(), hash );
|
|
|
|
hash = qHash( linkColor.rgba(), hash );
|
|
|
|
hash = qHashBits( &size, sizeof( QSizeF ), hash );
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
if ( hash == m_hash )
|
2017-07-21 18:21:34 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
m_hash = hash;
|
|
|
|
return true;
|
|
|
|
}
|