2019-06-19 14:08:45 +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_LINEAR_LAYOUT_ENGINE_H
|
|
|
|
#define QSK_LINEAR_LAYOUT_ENGINE_H
|
|
|
|
|
2019-07-13 11:01:48 +02:00
|
|
|
#include "QskGlobal.h"
|
|
|
|
|
2019-06-19 14:08:45 +02:00
|
|
|
#include <qnamespace.h>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class QQuickItem;
|
2019-07-13 11:01:48 +02:00
|
|
|
class QSizeF;
|
|
|
|
class QRectF;
|
2019-06-19 14:08:45 +02:00
|
|
|
|
|
|
|
class QskLinearLayoutEngine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QskLinearLayoutEngine( Qt::Orientation, uint dimension );
|
|
|
|
~QskLinearLayoutEngine();
|
|
|
|
|
|
|
|
Qt::Orientation orientation() const;
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setOrientation( Qt::Orientation );
|
2019-06-19 14:08:45 +02:00
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setDimension( uint dimension );
|
2019-06-19 14:08:45 +02:00
|
|
|
uint dimension() const;
|
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setDefaultAlignment( Qt::Alignment );
|
2019-06-19 14:08:45 +02:00
|
|
|
Qt::Alignment defaultAlignment() const;
|
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setExtraSpacingAt( Qt::Edges );
|
2019-06-19 14:08:45 +02:00
|
|
|
Qt::Edges extraSpacingAt() const;
|
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setVisualDirection( Qt::LayoutDirection );
|
|
|
|
Qt::LayoutDirection visualDirection() const;
|
|
|
|
|
|
|
|
bool setSpacing( qreal spacing, Qt::Orientations );
|
|
|
|
qreal spacing( Qt::Orientation ) const;
|
|
|
|
|
|
|
|
qreal defaultSpacing( Qt::Orientation ) const;
|
|
|
|
|
2019-06-19 14:08:45 +02:00
|
|
|
int count() const;
|
|
|
|
|
|
|
|
int rowCount() const;
|
|
|
|
int columnCount() const;
|
|
|
|
|
|
|
|
void insertItem( QQuickItem*, int index );
|
|
|
|
void addItem( QQuickItem* );
|
|
|
|
|
|
|
|
void insertSpacerAt( int index, qreal spacing );
|
|
|
|
void addSpacer( qreal spacing );
|
|
|
|
|
|
|
|
void removeAt( int index );
|
2019-07-13 10:36:12 +02:00
|
|
|
void clear();
|
2019-06-19 14:08:45 +02:00
|
|
|
|
|
|
|
QQuickItem* itemAt( int index ) const;
|
|
|
|
int spacerAt( int index ) const;
|
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setRetainSizeWhenHiddenAt( int index, bool on );
|
2019-06-19 14:08:45 +02:00
|
|
|
bool retainSizeWhenHiddenAt( int index ) const;
|
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setAlignmentAt( int index, Qt::Alignment );
|
2019-06-19 14:08:45 +02:00
|
|
|
Qt::Alignment alignmentAt( int index ) const;
|
|
|
|
|
2019-07-12 15:37:42 +02:00
|
|
|
bool setStretchFactorAt( int index, int stretchFactor );
|
2019-06-19 14:08:45 +02:00
|
|
|
int stretchFactorAt( int index ) const;
|
|
|
|
|
|
|
|
void setGeometries( const QRectF& );
|
|
|
|
|
|
|
|
qreal widthForHeight( qreal height ) const;
|
|
|
|
qreal heightForWidth( qreal width ) const;
|
|
|
|
|
|
|
|
QSizeF sizeHint( Qt::SizeHint, const QSizeF& contraint ) const;
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
EntryCache = 1 << 0,
|
|
|
|
CellCache = 1 << 1,
|
|
|
|
LayoutCache = 1 << 2
|
|
|
|
};
|
|
|
|
|
|
|
|
void invalidate( int what = EntryCache | CellCache | LayoutCache );
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateCellGeometries( const QSizeF& );
|
|
|
|
|
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(QskLinearLayoutEngine)
|
|
|
|
|
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr< PrivateData > m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|