code simplified

This commit is contained in:
Uwe Rathmann 2021-01-20 16:44:09 +01:00
parent a213d50170
commit 786e6c2446

View File

@ -33,6 +33,7 @@ namespace
: QskInputPanel( parent ) : QskInputPanel( parent )
{ {
setAutoLayoutChildren( true ); setAutoLayoutChildren( true );
setLayoutAlignmentHint( Qt::AlignCenter );
m_box = new QskInputPanelBox( this ); m_box = new QskInputPanelBox( this );
@ -243,33 +244,12 @@ class QskInputContext::PrivateData
popup->setAutoLayoutChildren( true ); popup->setAutoLayoutChildren( true );
popup->setTransparentForPositioner( false ); popup->setTransparentForPositioner( false );
popup->setMargins( 5 );
popup->setModal( true ); popup->setModal( true );
auto box = new QskLinearBox( popup ); panel->setParentItem( popup );
box->addItem( panel ); if ( panel->parent() == nullptr )
panel->setParent( popup );
const auto alignment = panel->alignment() & Qt::AlignVertical_Mask;
popup->setOverlay( alignment == Qt::AlignVCenter );
switch ( alignment )
{
case Qt::AlignTop:
{
box->setExtraSpacingAt( Qt::BottomEdge | Qt::LeftEdge | Qt::RightEdge );
break;
}
case Qt::AlignVCenter:
{
box->setMargins( QMarginsF( 5, 5, 5, 5 ) );
break;
}
case Qt::AlignBottom:
default:
{
box->setExtraSpacingAt( Qt::TopEdge | Qt::LeftEdge | Qt::RightEdge );
}
}
return popup; return popup;
} }