diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2014-06-20 01:27:43 -0700 |
---|---|---|
committer | Zeno Albisser <zeno.albisser@digia.com> | 2014-06-20 17:42:54 +0300 |
commit | 60355c949c4c8bf438465eaef0c0cc28a51fab53 (patch) | |
tree | 3d5b74bacb69432e5f182440457ec887edd908d5 | |
parent | e6a47635dc438ba896a180423bc714ccd59f4f8f (diff) |
Optimize behavior for hiding the address bar.
The address bar is only hidden,
when the WebEngineView gains focus.
It is hidden with a delay of 2 seconds.
This usually gives the impression the
address bar hides when the page loaded.
Change-Id: I3d62406b3de7219d831d195fd961d71c3debb767
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r-- | basicsuite/webengine/main.qml | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/basicsuite/webengine/main.qml b/basicsuite/webengine/main.qml index 30365ce..abcfe09 100644 --- a/basicsuite/webengine/main.qml +++ b/basicsuite/webengine/main.qml @@ -72,7 +72,6 @@ Rectangle { onLoadingChanged: { if (!loading) { addressBar.cursorPosition = 0 - toolBar.state = "address" } var loadError = loadRequest.errorDomain if (loadError == WebEngineView.NoErrorDomain) { @@ -91,6 +90,7 @@ Rectangle { else // HTTP and FTP errorPage.mainMessage = "Protocol error" } + onActiveFocusChanged: activeFocus ? hideTimer.running = true : toolBar.state = "address" } MultiPointTouchArea { @@ -134,13 +134,12 @@ Rectangle { Timer { id: hideTimer - interval: 3000 - running: (toolBar.state == "address" || toolBar.state == "") && !addressBar.activeFocus + interval: 2000 onTriggered: { - if (toolBar.state == "address") - toolBar.state = "hidden" - if (toolBar.state == "") - toolBar.state = "address" + if (addressBar.activeFocus) + return; + toolBar.state = "hidden" + running = false } } @@ -231,9 +230,11 @@ Rectangle { height: 25 iconSource: (toolBar.state == "hidden") ? "ui/icons/down.png" : "ui/icons/up.png" onClicked: { - if (toolBar.state == "hidden") + if (toolBar.state == "hidden") { toolBar.state = "address" - else + addressBar.forceActiveFocus() + addressBar.selectAll() + } else toolBar.state = "hidden" } anchors { |