using subControlRect

This commit is contained in:
Uwe Rathmann 2018-04-03 10:46:55 +02:00
parent 0a0acb5e27
commit 6f4a0045d5
2 changed files with 5 additions and 3 deletions

View File

@ -64,7 +64,7 @@ public Q_SLOTS:
void setText( const QString& text ); void setText( const QString& text );
void setGraphicSource( const QUrl& url ); void setGraphicSource( const QUrl& url );
void setGraphic( const QskGraphic& ); void setGraphic( const QskGraphic& );
Q_SIGNALS: Q_SIGNALS:
void cornerChanged(); void cornerChanged();
void borderWidthChanged(); void borderWidthChanged();

View File

@ -70,12 +70,14 @@ QSGNode* QskPushButtonSkinlet::updateSubNode(
QRectF QskPushButtonSkinlet::textRect( const QskPushButton* button ) const QRectF QskPushButtonSkinlet::textRect( const QskPushButton* button ) const
{ {
// buttonShift -> TODO // buttonShift -> TODO
QRectF r = button->innerBox( QskPushButton::Panel, button->contentsRect() );
QRectF r = button->innerBox( QskPushButton::Panel,
subControlRect( button, QskPushButton::Panel ) );
if ( button->hasGraphic() ) if ( button->hasGraphic() )
{ {
// in case of having text + graphic we put the text at the bottom // in case of having text + graphic we put the text at the bottom
qreal h = QFontMetrics( button->effectiveFont( QskPushButton::Text ) ).height(); qreal h = QFontMetrics( button->effectiveFont( QskPushButton::Text ) ).height();
if ( h < r.height() ) if ( h < r.height() )
r.setTop( r.bottom() - h ); r.setTop( r.bottom() - h );