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_LAYOUT_CONSTRAINT_H
|
|
|
|
#define QSK_LAYOUT_CONSTRAINT_H
|
|
|
|
|
|
|
|
#include "QskGlobal.h"
|
2018-08-03 08:30:23 +02:00
|
|
|
|
2018-07-19 14:10:48 +02:00
|
|
|
#include <qnamespace.h>
|
2017-07-21 18:21:34 +02:00
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
class QskSizePolicy;
|
2019-04-26 18:09:59 +02:00
|
|
|
class QskControl;
|
2019-07-12 15:24:06 +02:00
|
|
|
class QskLayoutHint;
|
2017-07-21 18:21:34 +02:00
|
|
|
class QQuickItem;
|
|
|
|
class QSizeF;
|
2019-05-17 22:33:38 +02:00
|
|
|
class QRectF;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2019-04-26 18:09:59 +02:00
|
|
|
namespace std { template< typename T > class function; }
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
namespace QskLayoutConstraint
|
|
|
|
{
|
2019-04-26 18:09:59 +02:00
|
|
|
enum Type
|
|
|
|
{
|
2019-05-12 15:26:57 +02:00
|
|
|
Unconstrained = 0,
|
2019-05-12 12:27:25 +02:00
|
|
|
|
2019-05-12 15:26:57 +02:00
|
|
|
WidthForHeight = 1 << 0,
|
|
|
|
HeightForWidth = 1 << 1
|
2019-04-26 18:09:59 +02:00
|
|
|
};
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
QSK_EXPORT qreal heightForWidth( const QQuickItem*, qreal width );
|
|
|
|
QSK_EXPORT qreal widthForHeight( const QQuickItem*, qreal height );
|
|
|
|
|
2019-05-12 12:27:25 +02:00
|
|
|
QSK_EXPORT Type constraintType( const QQuickItem* );
|
2019-07-12 15:24:06 +02:00
|
|
|
QSK_EXPORT bool isConstrained( const QQuickItem*, Qt::Orientation );
|
2019-05-12 12:27:25 +02:00
|
|
|
|
2019-04-26 18:09:59 +02:00
|
|
|
QSK_EXPORT qreal constrainedMetric(
|
|
|
|
Type, const QskControl*, qreal value,
|
|
|
|
std::function< qreal( Type, const QskControl*, qreal ) > );
|
|
|
|
|
2019-07-12 15:24:06 +02:00
|
|
|
QSK_EXPORT qreal constrainedChildrenMetric(
|
|
|
|
Type, const QskControl*, qreal constraint );
|
2019-04-26 18:09:59 +02:00
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
QSK_EXPORT QskSizePolicy sizePolicy( const QQuickItem* );
|
|
|
|
|
2018-11-17 09:22:11 +01:00
|
|
|
QSK_EXPORT QSizeF boundedSize( const QQuickItem*, const QSizeF& );
|
|
|
|
QSK_EXPORT QSizeF adjustedSize( const QQuickItem*, const QSizeF& );
|
|
|
|
|
2019-05-12 12:27:25 +02:00
|
|
|
QSK_EXPORT QSizeF sizeHint(
|
|
|
|
const QQuickItem*, Qt::SizeHint, const QSizeF& constraint );
|
|
|
|
|
2019-06-13 14:00:30 +02:00
|
|
|
QSK_EXPORT qreal sizeHint(
|
|
|
|
const QQuickItem*, Qt::SizeHint, Qt::Orientation, qreal constraint );
|
|
|
|
|
2019-05-17 22:33:38 +02:00
|
|
|
QSK_EXPORT QRectF itemRect(
|
|
|
|
const QQuickItem*, const QRectF&, Qt::Alignment );
|
|
|
|
|
2019-07-12 15:24:06 +02:00
|
|
|
QSK_EXPORT QskLayoutHint layoutHint(
|
|
|
|
const QQuickItem*, Qt::Orientation, qreal constraint );
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
const qreal unlimited = std::numeric_limits< float >::max();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|