PC3 Page: Improve implicit size calculation

Also remove unnecessary code for contentWidth/contentHeight. It's already handled the exact same way in the C++ of QQC2 Page.
This commit is contained in:
Noah Davis 2021-06-28 08:59:37 -04:00
parent 52b95888d5
commit 9fd111d867
1 changed files with 8 additions and 5 deletions

View File

@ -8,10 +8,13 @@ import QtQuick 2.6
import QtQuick.Templates @QQC2_VERSION@ as T
T.Page {
implicitWidth: contentWidth + leftPadding + rightPadding
implicitHeight: contentHeight + topPadding + bottomPadding
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding,
implicitHeaderWidth,
implicitFooterWidth)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
+ (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
}