QskControl::LayoutOutWhenHidden flag added
This commit is contained in:
parent
4dad15f591
commit
1941fbc847
@ -59,7 +59,14 @@ class QSK_EXPORT QskControl : public QskQuickItem, public QskSkinnable
|
||||
enum LayoutHint
|
||||
{
|
||||
// How to be treated by layouts
|
||||
RetainSizeWhenHidden = 1 << 0
|
||||
RetainSizeWhenHidden = 1 << 0,
|
||||
|
||||
/*
|
||||
Adjust the item even, even when being hidden
|
||||
Depending on the type of layout the value only works
|
||||
in combination with RetainSizeWhenHidden
|
||||
*/
|
||||
LayoutOutWhenHidden = 1 << 1
|
||||
};
|
||||
|
||||
Q_ENUM( LayoutHint )
|
||||
|
@ -581,7 +581,7 @@ void QskGridLayoutEngine::layoutItems()
|
||||
{
|
||||
auto item = element.item();
|
||||
|
||||
if ( item && qskIsVisibleToParent( item ) )
|
||||
if ( requiresAdjustment( item ) )
|
||||
{
|
||||
const auto grid = m_data->effectiveGrid( element );
|
||||
layoutItem( item, grid );
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "QskLayoutEngine2D.h"
|
||||
#include "QskLayoutChain.h"
|
||||
#include "QskLayoutHint.h"
|
||||
#include "QskControl.h"
|
||||
#include "QskQuick.h"
|
||||
|
||||
#include <qguiapplication.h>
|
||||
@ -652,3 +653,19 @@ QskSizePolicy::ConstraintType QskLayoutEngine2D::constraintType() const
|
||||
return static_cast< QskSizePolicy::ConstraintType >( m_data->constraintType );
|
||||
}
|
||||
|
||||
bool QskLayoutEngine2D::requiresAdjustment( const QQuickItem* item ) const
|
||||
{
|
||||
if ( qskIsVisibleToParent( item ) )
|
||||
return true;
|
||||
|
||||
if ( auto control = qskControlCast( item ) )
|
||||
{
|
||||
constexpr auto mask =
|
||||
QskControl::RetainSizeWhenHidden | QskControl::LayoutOutWhenHidden;
|
||||
|
||||
if ( control->layoutHints() & mask )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ class QskLayoutEngine2D
|
||||
};
|
||||
|
||||
void invalidate( int what );
|
||||
bool requiresAdjustment( const QQuickItem* ) const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY( QskLayoutEngine2D )
|
||||
|
@ -348,7 +348,7 @@ void QskLinearLayoutEngine::layoutItems()
|
||||
|
||||
if ( auto item = element.item() )
|
||||
{
|
||||
if ( qskIsVisibleToParent( item ) )
|
||||
if ( requiresAdjustment( item ) )
|
||||
{
|
||||
const QRect grid( col, row, 1, 1 );
|
||||
layoutItem( item, grid );
|
||||
|
@ -331,6 +331,10 @@ void QskStackBox::updateLayout()
|
||||
if ( maybeUnresized() )
|
||||
return;
|
||||
|
||||
#if 1
|
||||
// what about QskControl::LayoutOutWhenHidden
|
||||
#endif
|
||||
|
||||
const auto index = m_data->currentIndex;
|
||||
|
||||
if ( index >= 0 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user