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_FUNCTIONS_H
|
|
|
|
#define QSK_FUNCTIONS_H
|
|
|
|
|
|
|
|
#include "QskGlobal.h"
|
|
|
|
|
2018-07-19 14:10:48 +02:00
|
|
|
#include <qmargins.h>
|
|
|
|
#include <qrect.h>
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2020-03-10 10:17:44 +01:00
|
|
|
class QScreen;
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
QSK_EXPORT qreal qskDpiScaled( qreal value );
|
2020-03-10 10:17:44 +01:00
|
|
|
QSK_EXPORT bool qskHasPlatformWindowManagement();
|
|
|
|
QSK_EXPORT QRect qskPlatformScreenGeometry( const QScreen* );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
QSK_EXPORT QRect qskAlignedRect( const QRect& outerRect,
|
|
|
|
int width, int height, Qt::Alignment alignment );
|
|
|
|
|
|
|
|
QSK_EXPORT QRectF qskAlignedRectF( const QRectF& outerRect,
|
|
|
|
qreal width, qreal height, Qt::Alignment alignment );
|
|
|
|
|
|
|
|
QSK_EXPORT QRect qskInnerRect( const QRectF& rect );
|
2019-04-10 19:37:59 +02:00
|
|
|
QSK_EXPORT QRectF qskInnerRectF( const QRectF& rect );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
QSK_EXPORT QRectF qskValidOrEmptyInnerRect(
|
|
|
|
const QRectF& rect, const QMarginsF& margins );
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
inline bool qskFuzzyCompare( qreal value1, qreal value2 )
|
|
|
|
{
|
|
|
|
if ( qFuzzyIsNull( value1 ) )
|
|
|
|
return qFuzzyIsNull( value2 );
|
|
|
|
|
|
|
|
if ( qFuzzyIsNull( value2 ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return qFuzzyCompare( value1, value2 );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QMarginsF qskMargins( const QRectF& rect, const QRectF& innerRect )
|
|
|
|
{
|
|
|
|
return QMarginsF(
|
|
|
|
innerRect.left() - rect.left(),
|
|
|
|
innerRect.top() - rect.top(),
|
|
|
|
rect.right() - innerRect.right(),
|
2018-08-03 08:15:28 +02:00
|
|
|
rect.bottom() - innerRect.bottom() );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|