keyboard: fix layout calculation
This commit is contained in:
parent
7af9cc6cdf
commit
b68fc92cc9
@ -559,8 +559,8 @@ void QskSquiekSkin::initInputPanelHints()
|
|||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
// key panel
|
// key panel
|
||||||
setMargins( QskInputPanel::Panel | Margin, 2 );
|
setMargins( QskInputPanel::Panel | Padding, 5 );
|
||||||
setButton( QskInputPanel::Panel, Raised );
|
setPanel( QskInputPanel::Panel, Raised );
|
||||||
|
|
||||||
setButton( Q::Panel, Raised );
|
setButton( Q::Panel, Raised );
|
||||||
setButton( Q::Panel | Q::Pressed, Sunken );
|
setButton( Q::Panel | Q::Pressed, Sunken );
|
||||||
|
@ -559,14 +559,6 @@ void QskInputPanel::setCandidateOffset( int candidateOffset )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskInputPanel::keyboardRect() const
|
|
||||||
{
|
|
||||||
auto keyboardRect = rect(); // ### margins? would eliminate this thing below
|
|
||||||
// if ( QskDialog::instance()->policy() != QskDialog::TopLevelWindow )
|
|
||||||
// keyboardRect.adjust( 0, keyboardRect.height() * 0.5, 0, 0 );
|
|
||||||
return keyboardRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QskInputPanel::registerCompositionModelForLocale( const QLocale& locale,
|
void QskInputPanel::registerCompositionModelForLocale( const QLocale& locale,
|
||||||
QskInputCompositionModel* model )
|
QskInputCompositionModel* model )
|
||||||
{
|
{
|
||||||
@ -586,18 +578,19 @@ void QskInputPanel::updateLayout()
|
|||||||
if( geometry().isNull() )
|
if( geometry().isNull() )
|
||||||
return; // no need to calculate anything, will be called again
|
return; // no need to calculate anything, will be called again
|
||||||
|
|
||||||
QMarginsF margins = marginsHint( Panel | QskAspect::Margin );
|
QRectF rect = layoutRect();
|
||||||
QRectF rect = keyboardRect().marginsRemoved( margins );
|
|
||||||
qreal verticalSpacing = m_data->buttonsBox->spacing();
|
qreal verticalSpacing = m_data->buttonsBox->spacing();
|
||||||
|
|
||||||
for( QQuickItem* rowItem : m_data->buttonsBox->childItems() )
|
const auto& children = m_data->buttonsBox->childItems();
|
||||||
|
for( auto rowItem : children )
|
||||||
{
|
{
|
||||||
QskLinearBox* rowBox = qobject_cast< QskLinearBox* >( rowItem );
|
auto rowBox = qobject_cast< QskLinearBox* >( rowItem );
|
||||||
qreal horizontalSpacing = rowBox->spacing();
|
const qreal horizontalSpacing = rowBox->spacing();
|
||||||
|
|
||||||
for( QQuickItem* keyItem : rowBox->childItems() )
|
const auto& rowChildren = rowBox->childItems();
|
||||||
|
for( auto keyItem : rowChildren )
|
||||||
{
|
{
|
||||||
QskKeyButton* button = qobject_cast< QskKeyButton* >( keyItem );
|
auto button = qobject_cast< QskKeyButton* >( keyItem );
|
||||||
QRectF keyRect = keyDataAt( button->keyIndex() ).rect;
|
QRectF keyRect = keyDataAt( button->keyIndex() ).rect;
|
||||||
qreal width = keyRect.width() * rect.width() - horizontalSpacing;
|
qreal width = keyRect.width() * rect.width() - horizontalSpacing;
|
||||||
qreal height = keyRect.height() * rect.height() - verticalSpacing;
|
qreal height = keyRect.height() * rect.height() - verticalSpacing;
|
||||||
|
@ -42,8 +42,6 @@ class QSK_EXPORT QskInputPanel : public QskBox
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( QRectF keyboardRect READ keyboardRect NOTIFY keyboardRectChanged )
|
|
||||||
|
|
||||||
Q_PROPERTY( QString displayLanguageName READ displayLanguageName
|
Q_PROPERTY( QString displayLanguageName READ displayLanguageName
|
||||||
NOTIFY displayLanguageNameChanged )
|
NOTIFY displayLanguageNameChanged )
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user