From 8058615c029bd101ef0a7551145caca2d2f1fb4b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 10 Apr 2019 19:37:59 +0200 Subject: [PATCH] qskInnerRectF added --- src/common/QskFunctions.cpp | 10 ++++++++++ src/common/QskFunctions.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/common/QskFunctions.cpp b/src/common/QskFunctions.cpp index 7c3b47f0..f5ea912f 100644 --- a/src/common/QskFunctions.cpp +++ b/src/common/QskFunctions.cpp @@ -75,6 +75,16 @@ QRect qskInnerRect( const QRectF& rect ) return QRect( left, top, right - left, bottom - top ); } +QRectF qskInnerRectF( const QRectF& rect ) +{ + const qreal left = qCeil( rect.left() ); + const qreal top = qCeil( rect.top() ); + const qreal right = qFloor( rect.right() ); + const qreal bottom = qFloor( rect.bottom() ); + + return QRectF( left, top, right - left, bottom - top ); +} + QRectF qskValidOrEmptyInnerRect( const QRectF& rect, const QMarginsF& margins ) { qreal x, y, h, w; diff --git a/src/common/QskFunctions.h b/src/common/QskFunctions.h index 0e32d4b4..9f189a00 100644 --- a/src/common/QskFunctions.h +++ b/src/common/QskFunctions.h @@ -20,6 +20,7 @@ QSK_EXPORT QRectF qskAlignedRectF( const QRectF& outerRect, qreal width, qreal height, Qt::Alignment alignment ); QSK_EXPORT QRect qskInnerRect( const QRectF& rect ); +QSK_EXPORT QRectF qskInnerRectF( const QRectF& rect ); QSK_EXPORT QRectF qskValidOrEmptyInnerRect( const QRectF& rect, const QMarginsF& margins );