demos/declarative/webbrowser/content/Header.qml
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    49 
    49 
    50     source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally
    50     source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally
    51 
    51 
    52     x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width
    52     x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width
    53        ? -webView.contentX+webView.contentWidth-webView.width : 0
    53        ? -webView.contentX+webView.contentWidth-webView.width : 0
    54 
       
    55     y: {
    54     y: {
    56         if (webView.progress < 1.0)
    55         if (webView.progress < 1.0)
    57             return 0;
    56             return 0;
    58         else {
    57         else {
    59             webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY
    58             webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY
    60         }
    59         }
    61     }
    60     }
    62 
       
    63     Column {
    61     Column {
    64         width: parent.width
    62         width: parent.width
    65 
    63 
    66         Item {
    64         Item {
    67             width: parent.width; height: 20
    65             width: parent.width; height: 20
    99                 onUrlChanged: header.urlChanged = true
    97                 onUrlChanged: header.urlChanged = true
   100             }
    98             }
   101 
    99 
   102             Button {
   100             Button {
   103                 id: reloadButton
   101                 id: reloadButton
   104                 anchors { right: parent.right; rightMargin: 4 }
   102                 anchors { right: quitButton.left; rightMargin: 10 }
   105                 action: webView.reload; image: "pics/view-refresh.png"
   103                 action: webView.reload; image: "pics/view-refresh.png"
   106                 visible: webView.progress == 1.0 && !header.urlChanged
   104                 visible: webView.progress == 1.0 && !header.urlChanged
       
   105             }
       
   106             Text {
       
   107                 id: quitButton
       
   108                 color: "white"
       
   109                 style: Text.Sunken
       
   110                 anchors.right: parent.right
       
   111                 anchors.top: parent.top
       
   112                 anchors.bottom: parent.bottom
       
   113                 verticalAlignment: Text.AlignVCenter
       
   114                 horizontalAlignment: Text.AlignHCenter
       
   115                 font.pixelSize: 18
       
   116                 width: 60
       
   117                 text: "Quit"
       
   118                 MouseArea {
       
   119                     anchors.fill: parent
       
   120                     onClicked: Qt.quit()
       
   121                 }
       
   122                 Rectangle {
       
   123                     width: 1
       
   124                     y: 5
       
   125                     height: parent.height-10
       
   126                     anchors.right: parent.left
       
   127                     color: "darkgray"
       
   128                 }
   107             }
   129             }
   108 
   130 
   109             Button {
   131             Button {
   110                 id: stopButton
   132                 id: stopButton
   111                 anchors { right: parent.right; rightMargin: 4 }
   133                 anchors { right: quitButton.left; rightMargin: 10 }
   112                 action: webView.stop; image: "pics/edit-delete.png"
   134                 action: webView.stop; image: "pics/edit-delete.png"
   113                 visible: webView.progress < 1.0 && !header.urlChanged
   135                 visible: webView.progress < 1.0 && !header.urlChanged
   114             }
   136             }
   115 
   137 
   116             Button {
   138             Button {