qskinny/src/nodes/QskTextRenderer.h

55 lines
1.4 KiB
C
Raw Normal View History

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
*****************************************************************************/
#ifndef QSK_TEXT_RENDERER_H
#define QSK_TEXT_RENDERER_H
#include "QskGlobal.h"
#include "QskNamespace.h"
#include "QskTextOptions.h"
#include <QFont>
#include <QRectF>
class QskTextHelperItem;
2017-10-20 20:26:39 +02:00
class QskTextColors;
2017-07-21 18:21:34 +02:00
class QQuickItem;
class QQuickWindow;
class QSGTransformNode;
class QColor;
// Hacking a QQuickTextNode using a QQuickText helper item
// How to create the nodes in a better way needs further
// investigations
class QSK_EXPORT QskTextRenderer
{
public:
void setFont( const QFont& font );
void setOptions( const QskTextOptions& );
void setAlignment( Qt::Alignment );
2017-10-20 20:26:39 +02:00
void updateNode( const QString&, const QSizeF&,
Qsk::TextStyle, const QskTextColors&,
const QQuickItem*, QSGTransformNode* );
2017-07-21 18:21:34 +02:00
2017-10-20 20:26:39 +02:00
void updateNode( const QString&, const QRectF&,
Qsk::TextStyle, const QskTextColors&,
const QQuickItem*, QSGTransformNode* );
2017-07-21 18:21:34 +02:00
2017-10-20 15:29:50 +02:00
QSizeF textSize( const QString& ) const;
2017-07-21 18:21:34 +02:00
QRectF textRect( const QSizeF&, const QString& ) const;
private:
void setupItem( QskTextHelperItem* ) const;
QFont m_font;
QskTextOptions m_options;
Qt::Alignment m_alignment;
};
#endif