From 89023e8c41313ce6fb0905bf2a95362cbc360aee Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Sat, 18 Aug 2012 11:30:50 +1000 Subject: [PATCH] Welcome page: display tooltips below buttons if necessary Useful on low res screen, to ensure tooltips are visible --- .../plugins/welcome/qml/WelcomePageButton.qml | 22 ++++++++++++++---- .../qml/images/button-label-bottom.png | Bin 0 -> 3159 bytes .../src/plugins/welcome/welcome.qrc | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/welcome/qml/images/button-label-bottom.png diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml b/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml index 09834d3ed..4874022be 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml @@ -5,6 +5,7 @@ Item { id: welcomeButton width: Math.max(116, icon.width) height: 116 + z: 0 property string baseIconName property alias label : labelText.text @@ -26,18 +27,21 @@ Item { Image { id: labelImage - source: "images/button-label.png" + property bool displayBelowButton: false + source: displayBelowButton ? "images/button-label-bottom.png" : "images/button-label.png" opacity: 0 visible: labelText.text.length > 0 //don't show label bg without text + anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: hoveredIcon.top - anchors.bottomMargin: -8 + y: displayBelowButton ? parent.height-8 : -height+8 Text { id: labelText - anchors.baseline: parent.verticalCenter - anchors.baselineOffset: -4 + anchors.baseline: parent.bottom + //text baseline depends on label image orientation, + //0.3 and 0.55 constants have to be adjusted when button-label.png is modified + anchors.baselineOffset: labelImage.displayBelowButton ? -parent.height*0.3 : -parent.height*0.55 anchors.horizontalCenter: parent.horizontalCenter font { @@ -50,8 +54,16 @@ Item { states: State { name: "hovered" + //update the tooltip position before it's displayed, + //since we don't have a property to bind directly + StateChangeScript { + name: "updateLabelPosition" + script: labelImage.displayBelowButton = welcomeButton.mapToItem(null,0,0).y < labelImage.height + } PropertyChanges { target: hoveredIcon; opacity: 1.0 } PropertyChanges { target: labelImage; opacity: 1.0 } + //raise this button, so tooltip is not obscured by the next items in the grid + PropertyChanges { target: welcomeButton; z: 1 } } transitions: Transition { diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/images/button-label-bottom.png b/ground/openpilotgcs/src/plugins/welcome/qml/images/button-label-bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d885658c031baedce78683236b37b341293b65 GIT binary patch literal 3159 zcmV-d45;&oP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyn} z05u(=e+*6l01MYiL_t(|+U=chY#Zer$G>;yyYt!SyNey$Z4=QyNf0d|MJ{w*)KP(8 zuxLurR+P1C3+V?Aq`Otc!78Uh-$0aCRKyhsM|Ce zx|SxyZbD+m=e@{t@so=k`)nt1oZnA6>2kif_4#w(`#jHcmq!3qtxG7fJx7OTZ4WqA z<;PM0AQk}FCYV>Jd~^tET9Ru4fUIkws<$N0(Qe} z2MxneG)-IF(eL*o6bcDFJv}G8y1F`xfGiNm1o2vXu*{UeU_izO1_pi^i^ZbBU~pOA zXCM%OX`0&ck^;q&|bCErVyWf+Em0|yTDJo)642N}rC z9LNfR?7e8P!+Qcp0K_#-YaJLEcr_M_MGARvu~JnPhG9s(y}hRbfQv#1$Kfv-DoDe>~8_EZD3&F7wzrs516J|upw6t$hxj0 z5{U#(oH+4nTU*-$0JgCPUlTiFRCWSUKXR$#S?wD%N=R__1CF$=gz%#>C&Yu z4CK22rZ|x28OV+Ngb3e0u=%X424eopbz11oQwyRCWMP9t>?nlOh|^iGLBz7G)}f)H z!M3)x9hPN5mgSoMKPd@qNgLmJ3_iqehCyi&_TG2otJIOnb{F5+qoJwU}DP0m`flFQm z3*-A5Yv2Ufy3^>88bB-f8+v5+c>{)FM0$IBpLz7rN53Bqhow*`|YGx?>LC<1_RmV(s!19)){V@WndTl>_QQMeOw}iSnJ$m>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I&Z5AubFr41fTgpHDjd)XQx0c>Xkmr-p`t3u zFY+VC^Gp@e9Jo&U+U^7{1+hDoon&_Af97X(Ecd;rs0snh_l_;z`rzm+w>`HKq$mSq xr}*Th1g2VzMCOyZ5bRV`jaLFqTtc;Ej;AUn~5i5UO@002ovPDHLkV1j(}3}pZS literal 0 HcmV?d00001 diff --git a/ground/openpilotgcs/src/plugins/welcome/welcome.qrc b/ground/openpilotgcs/src/plugins/welcome/welcome.qrc index 8edecd01e..2fc8bf23c 100644 --- a/ground/openpilotgcs/src/plugins/welcome/welcome.qrc +++ b/ground/openpilotgcs/src/plugins/welcome/welcome.qrc @@ -9,6 +9,7 @@ qml/images/welcome-news-bg.png qml/images/welcome-op-logo.png qml/images/button-label.png + qml/images/button-label-bottom.png qml/images/welcome-op-bg.png qml/images/welcome-bg.png qml/images/flightdata-on.png