layout code fixed
This commit is contained in:
parent
277d8dd8d6
commit
2df8d81174
@ -42,6 +42,28 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void setGeometry( const QRectF& rect )
|
||||
{
|
||||
auto d = QQuickTextPrivate::get( this );
|
||||
|
||||
d->heightValid = true;
|
||||
d->widthValid = true;
|
||||
|
||||
if ( ( d->x != rect.x() ) || ( d->y != rect.y() ) )
|
||||
{
|
||||
d->x = rect.x();
|
||||
d->y = rect.y();
|
||||
d->dirty( QQuickItemPrivate::Position );
|
||||
}
|
||||
|
||||
if ( ( d->width != rect.width() ) || ( d->height != rect.height() ) )
|
||||
{
|
||||
d->height = rect.height();
|
||||
d->width = rect.width();
|
||||
d->dirty( QQuickItemPrivate::Size );
|
||||
}
|
||||
}
|
||||
|
||||
inline void setAlignment( Qt::Alignment alignment )
|
||||
{
|
||||
setHAlign( ( QQuickText::HAlignment ) ( int( alignment ) & 0x0f ) );
|
||||
@ -57,8 +79,16 @@ namespace
|
||||
setWrapMode( static_cast< QQuickText::WrapMode >( options.wrapMode() ) );
|
||||
}
|
||||
|
||||
void begin() { classBegin(); }
|
||||
void end() { componentComplete(); }
|
||||
void begin()
|
||||
{
|
||||
classBegin();
|
||||
QQuickTextPrivate::get( this )->updateOnComponentComplete = true;
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
componentComplete();
|
||||
}
|
||||
|
||||
QRectF layedOutTextRect() const
|
||||
{
|
||||
@ -150,28 +180,14 @@ void QskRichTextRenderer::updateNode( const QString& text,
|
||||
|
||||
textItem.begin();
|
||||
|
||||
textItem.setGeometry( rect );
|
||||
|
||||
textItem.setBottomPadding( 0 );
|
||||
textItem.setTopPadding( 0 );
|
||||
textItem.setFont( font );
|
||||
textItem.setOptions( options );
|
||||
textItem.setAlignment( alignment );
|
||||
|
||||
#if 0
|
||||
// the position of textItem seems to have no effect
|
||||
// on the position of the node. We do it by translation later.
|
||||
|
||||
textItem.setX( rect.x() );
|
||||
textItem.setY( rect.y() );
|
||||
#endif
|
||||
|
||||
if ( rect.width() != item->width() ||
|
||||
rect.height() != item->height() )
|
||||
{
|
||||
textItem.setWidth( rect.width() );
|
||||
textItem.setHeight( rect.height() );
|
||||
textItem.doLayout();
|
||||
}
|
||||
|
||||
textItem.setColor( colors.textColor );
|
||||
textItem.setStyle( static_cast< QQuickText::TextStyle >( style ) );
|
||||
textItem.setStyleColor( colors.styleColor );
|
||||
|
Loading…
x
Reference in New Issue
Block a user