From 6f4a0045d538a7b9d1ca376ec99897c9cd45552f Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 3 Apr 2018 10:46:55 +0200 Subject: [PATCH] using subControlRect --- src/controls/QskPushButton.h | 2 +- src/controls/QskPushButtonSkinlet.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controls/QskPushButton.h b/src/controls/QskPushButton.h index dc9ced5e..443d8b4b 100644 --- a/src/controls/QskPushButton.h +++ b/src/controls/QskPushButton.h @@ -64,7 +64,7 @@ public Q_SLOTS: void setText( const QString& text ); void setGraphicSource( const QUrl& url ); void setGraphic( const QskGraphic& ); - + Q_SIGNALS: void cornerChanged(); void borderWidthChanged(); diff --git a/src/controls/QskPushButtonSkinlet.cpp b/src/controls/QskPushButtonSkinlet.cpp index edab40d3..06d373f2 100644 --- a/src/controls/QskPushButtonSkinlet.cpp +++ b/src/controls/QskPushButtonSkinlet.cpp @@ -70,12 +70,14 @@ QSGNode* QskPushButtonSkinlet::updateSubNode( QRectF QskPushButtonSkinlet::textRect( const QskPushButton* button ) const { // buttonShift -> TODO - QRectF r = button->innerBox( QskPushButton::Panel, button->contentsRect() ); + + QRectF r = button->innerBox( QskPushButton::Panel, + subControlRect( button, QskPushButton::Panel ) ); if ( button->hasGraphic() ) { // in case of having text + graphic we put the text at the bottom - + qreal h = QFontMetrics( button->effectiveFont( QskPushButton::Text ) ).height(); if ( h < r.height() ) r.setTop( r.bottom() - h );