From 6453b44742d709f4e3cc46bf5f5b8d0cef64bb66 Mon Sep 17 00:00:00 2001 From: Jarkko Koivikko Date: Tue, 15 May 2018 18:28:31 +0300 Subject: Fix anchor warning in default styles Fixes warnings like: qrc:/QtQuick/VirtualKeyboard/content/styles/default/style.qml:136:9: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling. [ChangeLog] Fixed qml anchor warnings from default styles Task-number: QTBUG-67677 Change-Id: I9d079dc02e9530431020c19ac3a5db9cee6f76a1 (cherry picked from commit 7e8a17f8af88b3434f9d5763dd528a29ec40bf8c) Reviewed-by: Mitch Curtis Reviewed-by: Jarkko Koivikko --- .../content/styles/default/style.qml | 33 +++++++++----- src/virtualkeyboard/content/styles/retro/style.qml | 52 +++++++++++++--------- 2 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/virtualkeyboard/content/styles/default/style.qml b/src/virtualkeyboard/content/styles/default/style.qml index 6c49ee67..d4b6c119 100644 --- a/src/virtualkeyboard/content/styles/default/style.qml +++ b/src/virtualkeyboard/content/styles/default/style.qml @@ -63,11 +63,12 @@ KeyboardStyle { } keyPanel: KeyPanel { + id: keyPanel Rectangle { id: keyBackground radius: 5 color: "#383533" - anchors.fill: parent + anchors.fill: keyPanel anchors.margins: keyBackgroundMargin Text { id: keySmallText @@ -132,11 +133,12 @@ KeyboardStyle { } backspaceKeyPanel: KeyPanel { + id: backspaceKeyPanel Rectangle { id: backspaceKeyBackground radius: 5 color: "#23211E" - anchors.fill: parent + anchors.fill: backspaceKeyPanel anchors.margins: keyBackgroundMargin Image { id: backspaceKeyIcon @@ -176,11 +178,12 @@ KeyboardStyle { } languageKeyPanel: KeyPanel { + id: languageKeyPanel Rectangle { id: languageKeyBackground radius: 5 color: "#35322f" - anchors.fill: parent + anchors.fill: languageKeyPanel anchors.margins: keyBackgroundMargin Image { id: languageKeyIcon @@ -220,11 +223,12 @@ KeyboardStyle { } enterKeyPanel: KeyPanel { + id: enterKeyPanel Rectangle { id: enterKeyBackground radius: 5 color: "#1e1b18" - anchors.fill: parent + anchors.fill: enterKeyPanel anchors.margins: keyBackgroundMargin Image { id: enterKeyIcon @@ -316,11 +320,12 @@ KeyboardStyle { } hideKeyPanel: KeyPanel { + id: hideKeyPanel Rectangle { id: hideKeyBackground radius: 5 color: "#1e1b18" - anchors.fill: parent + anchors.fill: hideKeyPanel anchors.margins: keyBackgroundMargin Image { id: hideKeyIcon @@ -360,11 +365,12 @@ KeyboardStyle { } shiftKeyPanel: KeyPanel { + id: shiftKeyPanel Rectangle { id: shiftKeyBackground radius: 5 color: "#1e1b18" - anchors.fill: parent + anchors.fill: shiftKeyPanel anchors.margins: keyBackgroundMargin Image { id: shiftKeyIcon @@ -426,11 +432,12 @@ KeyboardStyle { } spaceKeyPanel: KeyPanel { + id: spaceKeyPanel Rectangle { id: spaceKeyBackground radius: 5 color: "#35322f" - anchors.fill: parent + anchors.fill: spaceKeyPanel anchors.margins: keyBackgroundMargin Text { id: spaceKeyText @@ -466,11 +473,12 @@ KeyboardStyle { } symbolKeyPanel: KeyPanel { + id: symbolKeyPanel Rectangle { id: symbolKeyBackground radius: 5 color: "#1e1b18" - anchors.fill: parent + anchors.fill: symbolKeyPanel anchors.margins: keyBackgroundMargin Text { id: symbolKeyText @@ -517,11 +525,12 @@ KeyboardStyle { } modeKeyPanel: KeyPanel { + id: modeKeyPanel Rectangle { id: modeKeyBackground radius: 5 color: "#1e1b18" - anchors.fill: parent + anchors.fill: modeKeyPanel anchors.margins: keyBackgroundMargin Text { id: modeKeyText @@ -581,11 +590,12 @@ KeyboardStyle { } handwritingKeyPanel: KeyPanel { + id: handwritingKeyPanel Rectangle { id: hwrKeyBackground radius: 5 color: "#35322f" - anchors.fill: parent + anchors.fill: handwritingKeyPanel anchors.margins: keyBackgroundMargin Image { id: hwrKeyIcon @@ -747,12 +757,13 @@ KeyboardStyle { } traceInputKeyPanelDelegate: TraceInputKeyPanel { + id: traceInputKeyPanel traceMargins: keyBackgroundMargin Rectangle { id: traceInputKeyPanelBackground radius: 5 color: "#35322f" - anchors.fill: parent + anchors.fill: traceInputKeyPanel anchors.margins: keyBackgroundMargin Text { id: hwrInputModeIndicator diff --git a/src/virtualkeyboard/content/styles/retro/style.qml b/src/virtualkeyboard/content/styles/retro/style.qml index c22338ba..53d09399 100644 --- a/src/virtualkeyboard/content/styles/retro/style.qml +++ b/src/virtualkeyboard/content/styles/retro/style.qml @@ -67,11 +67,12 @@ KeyboardStyle { } keyPanel: KeyPanel { + id: keyPanel Image { id: keyBackground source: resourcePrefix + "images/key154px_colorA.png" fillMode: Image.PreserveAspectFit - anchors.fill: parent + anchors.fill: keyPanel anchors.margins: keyBackgroundMargin states: [ State { @@ -98,7 +99,7 @@ KeyboardStyle { id: keyText text: control.displayText color: "#110b05" - anchors.fill: parent + anchors.fill: keyPanel anchors.margins: keyContentMargin fontSizeMode: Text.Fit horizontalAlignment: Text.AlignHCenter @@ -151,12 +152,13 @@ KeyboardStyle { } backspaceKeyPanel: KeyPanel { + id: backspaceKeyPanel BorderImage { id: backspaceKeyBackground source: resourcePrefix + "images/key154px_black.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: backspaceKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -166,7 +168,7 @@ KeyboardStyle { } Image { id: backspaceKeyIcon - anchors.centerIn: parent + anchors.centerIn: backspaceKeyPanel sourceSize.width: 159 * keyIconScale sourceSize.height: 88 * keyIconScale smooth: false @@ -201,16 +203,17 @@ KeyboardStyle { } languageKeyPanel: KeyPanel { + id: languageKeyPanel Image { id: languageKeyBackground source: resourcePrefix + "images/key154px_colorB.png" fillMode: Image.PreserveAspectFit - anchors.fill: parent + anchors.fill: languageKeyPanel anchors.margins: keyBackgroundMargin } Image { id: languageKeyIcon - anchors.centerIn: parent + anchors.centerIn: languageKeyPanel sourceSize.width: 144 * keyIconScale sourceSize.height: 144 * keyIconScale smooth: false @@ -245,12 +248,13 @@ KeyboardStyle { } enterKeyPanel: KeyPanel { + id: enterKeyPanel BorderImage { id: enterKeyBackground source: resourcePrefix + "images/key154px_black.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: enterKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -261,7 +265,7 @@ KeyboardStyle { Image { id: enterKeyIcon visible: enterKeyText.text.length === 0 - anchors.centerIn: parent + anchors.centerIn: enterKeyPanel readonly property size enterKeyIconSize: { switch (control.actionId) { case EnterKeyAction.Go: @@ -300,7 +304,7 @@ KeyboardStyle { fontSizeMode: Text.HorizontalFit horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - anchors.fill: parent + anchors.fill: enterKeyPanel anchors.leftMargin: keyContentMargin anchors.topMargin: Math.round(50 * scaleHint) anchors.rightMargin: keyContentMargin @@ -350,12 +354,13 @@ KeyboardStyle { } hideKeyPanel: KeyPanel { + id: hideKeyPanel BorderImage { id: hideKeyBackground source: resourcePrefix + "images/key154px_black.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: hideKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -365,7 +370,7 @@ KeyboardStyle { } Image { id: hideKeyIcon - anchors.centerIn: parent + anchors.centerIn: hideKeyPanel sourceSize.width: 144 * keyIconScale sourceSize.height: 127 * keyIconScale smooth: false @@ -400,12 +405,13 @@ KeyboardStyle { } shiftKeyPanel: KeyPanel { + id: shiftKeyPanel BorderImage { id: shiftKeyBackground source: resourcePrefix + "images/key154px_black.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: shiftKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -441,7 +447,7 @@ KeyboardStyle { } Image { id: shiftKeyIcon - anchors.centerIn: parent + anchors.centerIn: shiftKeyPanel sourceSize.width: 144 * keyIconScale sourceSize.height: 134 * keyIconScale smooth: false @@ -476,12 +482,13 @@ KeyboardStyle { } spaceKeyPanel: KeyPanel { + id: spaceKeyPanel BorderImage { id: spaceKeyBackground source: resourcePrefix + "images/key154px_colorA.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: spaceKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -494,7 +501,7 @@ KeyboardStyle { text: Qt.locale(InputContext.locale).nativeLanguageName color: currentStyle.inputLocaleIndicatorColor Behavior on color { PropertyAnimation { duration: 250 } } - anchors.centerIn: parent + anchors.centerIn: spaceKeyPanel font { family: fontFamily weight: Font.Bold @@ -522,12 +529,13 @@ KeyboardStyle { } symbolKeyPanel: KeyPanel { + id: symbolKeyPanel BorderImage { id: symbolKeyBackground source: resourcePrefix + "images/key154px_black.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: symbolKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -539,7 +547,7 @@ KeyboardStyle { id: symbolKeyText text: control.displayText color: "#c5a96f" - anchors.centerIn: parent + anchors.centerIn: symbolKeyPanel font { family: fontFamily weight: Font.DemiBold @@ -577,12 +585,13 @@ KeyboardStyle { } modeKeyPanel: KeyPanel { + id: modeKeyPanel BorderImage { id: modeKeyBackground source: resourcePrefix + "images/key154px_black.png" width: (parent.width - 2 * keyBackgroundMargin) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: modeKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -604,7 +613,7 @@ KeyboardStyle { id: modeKeyText text: control.displayText color: "#c5a96f" - anchors.fill: parent + anchors.fill: modeKeyPanel anchors.margins: keyContentMargin fontSizeMode: Text.Fit horizontalAlignment: Text.AlignHCenter @@ -638,12 +647,13 @@ KeyboardStyle { } handwritingKeyPanel: KeyPanel { + id: handwritingKeyPanel BorderImage { id: hwrKeyBackground source: resourcePrefix + "images/key154px_colorB.png" width: (parent.width - 2 * hwrKeyBackground) / scale height: sourceSize.height - anchors.centerIn: parent + anchors.centerIn: handwritingKeyPanel border.left: 76 border.top: 76 border.right: 76 @@ -653,7 +663,7 @@ KeyboardStyle { } Image { id: hwrKeyIcon - anchors.centerIn: parent + anchors.centerIn: handwritingKeyPanel readonly property size hwrKeyIconSize: keyboard.handwritingMode ? Qt.size(124, 96) : Qt.size(156, 104) sourceSize.width: hwrKeyIconSize.width * keyIconScale sourceSize.height: hwrKeyIconSize.height * keyIconScale -- cgit v1.2.3