Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.36 KB | None | 0 0
  1.  
  2. import QtQuick.Controls 1.0
  3. import QtQuick 2.0
  4. import Ubuntu.Components 1.1
  5. import com.canonical.Oxide 1.0
  6. import QtQuick.Controls.Styles 1.2
  7. import QtQuick.Window 2.0
  8.  
  9.  
  10.  
  11. /*!
  12. \brief MainView with a Label and Button elements.
  13. */
  14.  
  15. MainView {
  16. // objectName for functional testing purposes (autopilot-qt5)
  17. objectName: "mainView"
  18.  
  19. // Note! applicationName needs to match the "name" field of the click manifest
  20. applicationName: "com.ubuntu.developer.mkamenjak77.bugapp"
  21.  
  22. /*
  23. This property enables the application to change orientation
  24. when the device is rotated. The default is false.
  25. */
  26. //automaticOrientation: true
  27.  
  28. // Removes the old toolbar and enables new features of the new header.
  29. useDeprecatedToolbar: false
  30.  
  31. width: Screen.width
  32. height: Screen.height
  33. Page {
  34. Column {
  35. spacing: units.gu(1)
  36. height:parent.height
  37. width:parent.width
  38. /* Label {
  39. id: label
  40. objectName: "label"
  41.  
  42. text: i18n.tr("Hello..")
  43. }*/
  44. Row{
  45. height:parent.height
  46. width:parent.width
  47. Column
  48. {
  49. TextArea
  50. {
  51. id:textfield;
  52. text: "http://google.com"
  53. width: units.gu(4)
  54. height: units.gu(75)
  55. contentWidth: units.gu(1.4)
  56. autoSize: true
  57. maximumLineCount: 0
  58. Keys.onReturnPressed:
  59. {
  60. if (textfield.text.substring(0, 7) != "http://")
  61. textfield.text = "http://" + textfield.text;
  62. webview.url = textfield.text
  63. }
  64. }
  65. Button
  66. {
  67. objectName: "button"
  68. iconSource: "refresh.png"
  69. width: units.gu(4)/*
  70. style: ButtonStyle {
  71. background: Rectangle {
  72. implicitWidth: 100
  73. implicitHeight: 25
  74. border.width: control.activeFocus ? 2 : 1
  75. border.color: "#888"
  76. radius: 4
  77. gradient: Gradient {
  78. GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
  79. GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
  80. }
  81. }
  82. }*/
  83. text: i18n.tr("Osvježi")
  84. onClicked: {
  85. webview.reload()
  86. }
  87. }
  88. Button {
  89. objectName: "button"
  90. iconSource: "forward.png"
  91. width: units.gu(4)/*
  92. style: ButtonStyle {
  93. background: Rectangle {
  94. implicitWidth: 100
  95. implicitHeight: 25
  96. border.width: control.activeFocus ? 2 : 1
  97. border.color: "#888"
  98. radius: 4
  99. gradient: Gradient {
  100. GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
  101. GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
  102. }
  103. }
  104. }*/
  105. text: i18n.tr("Naprijed")
  106. onClicked: {
  107. webview.goForward()
  108. }
  109. }
  110. Button {
  111. objectName: "button"
  112. iconSource: "backward.png"
  113. width: units.gu(4)/*
  114. style: ButtonStyle {
  115. background: Rectangle {
  116. implicitWidth: 100
  117. implicitHeight: 25
  118. border.width: control.activeFocus ? 2 : 1
  119. border.color: "#888"
  120. radius: 4
  121. gradient: Gradient {
  122. GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
  123. GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
  124. }
  125. }
  126. }*/
  127. text: i18n.tr("Natrag")
  128. onClicked: {
  129. webview.goBack()
  130. }
  131. }
  132. }
  133. WebView {
  134. id: webview
  135. width: parent.width
  136. height: parent.height
  137. //onLoadFinished: area.contentY = -1 // workaround to force webview repaint
  138. Component.onCompleted: {
  139. url = textfield.text
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement