CLTextArea.qml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /**
  2. * Copyright © 2010 Digia Plc
  3. * Copyright © 2010 Nokia Corporation
  4. *
  5. * All rights reserved.
  6. *
  7. * Nokia and Nokia Connecting People are registered trademarks of
  8. * Nokia Corporation.
  9. * Java and all Java-based marks are trademarks or registered
  10. * trademarks of
  11. * Sun Microsystems, Inc. Other product and company names
  12. * mentioned herein may be
  13. * trademarks or trade names of their respective owners.
  14. *
  15. *
  16. * Subject to the conditions below, you may, without charge:
  17. *
  18. * · Use, copy, modify and/or merge copies of this software and
  19. * associated documentation files (the "Software")
  20. *
  21. * · Publish, distribute, sub-licence and/or sell new software
  22. * derived from or incorporating the Software.
  23. *
  24. *
  25. * This file, unmodified, shall be included with all copies or
  26. * substantial portions
  27. * of the Software that are distributed in source code form.
  28. *
  29. * The Software cannot constitute the primary value of any new
  30. * software derived
  31. * from or incorporating the Software.
  32. *
  33. * Any person dealing with the Software shall not misrepresent
  34. * the source of the Software.
  35. *
  36. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  37. * KIND, EXPRESS OR IMPLIED,
  38. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  39. * MERCHANTABILITY, FITNESS FOR A
  40. * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41. * AUTHORS OR COPYRIGHT
  42. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  43. * WHETHER IN AN ACTION
  44. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  45. * CONNECTION WITH THE
  46. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  47. */
  48. import Qt 4.7
  49. import "javascripts/functions.js" as Functions
  50. /* TODO:
  51. * Next releases of Qt will change the usage of selectionStart and selectionEnd properties.
  52. * Properties are to be change to read only properties.
  53. * For selection functionalities, there will be select (start, end) -function.
  54. * When these changes are made, this component's selectionStart & selectionEnd- functionalities
  55. * has to be changed corresponding selection funtionality.
  56. */
  57. Rectangle{
  58. id:container
  59. property CLStyle style: CLStyle {}
  60. property string content: ""
  61. property bool readOnly: false
  62. property int maxLength: -1
  63. property bool horizontalScale: false
  64. property int scrollBarHeight: 0 //dont't write to documentation
  65. property alias cursorPosition: textArea.cursorPosition
  66. property alias selectionStart: textArea.selectionStart
  67. property alias selectionEnd: textArea.selectionEnd
  68. property real buttonRoundness: style.itemRoundness
  69. property real sledRoundness: style.roundness
  70. property color colorWhenDefault: style.colorWhenDefault
  71. property real roundness: style.roundness
  72. property int borderWidth: style.borderWidth
  73. property color borderColor: style.borderColor
  74. property int fontSize: style.fontSize
  75. property color textColor: style.textColor
  76. property color textColorWhenSelected: style.selectedTextColor
  77. property color textAreaColorWhenSelected: style.selectionColor
  78. property string fontFamily: style.fontFamily
  79. property string fontWeight: style.fontWeight
  80. property color bgColor: "transparent"
  81. property color scrollBarBgColor: style.bgColor
  82. property color colorWhenPressed: style.colorWhenPressed
  83. property color colorWhenHovered: style.colorWhenHovered
  84. property color borderColorWhenHovered: style.borderColorWhenHovered
  85. property color borderColorWhenPressed: style.borderColorWhenPressed //menen tässä
  86. property int borderWidthInner: style.borderWidthInner
  87. property color borderColorInner: style.borderColorInner
  88. property color borderColorInnerWhenHovered: style.borderColorInnerWhenHovered
  89. property color borderColorInnerWhenPressed: style.borderColorInnerWhenPressed
  90. property Gradient gradientBg: style.gradientBg
  91. property Gradient gradientWhenDefault: style.gradientWhenDefault
  92. property Gradient gradientWhenHovered: style.gradientWhenHovered
  93. property Gradient gradientWhenPressed: style.gradientWhenPressed
  94. property bool gradientDefaultOn: style.gradientDefaultOn
  95. property bool gradientHoveredOn: style.gradientHoveredOn
  96. property bool gradientPressedOn: style.gradientPressedOn
  97. property bool gradientBgOn: style.gradientBgOn
  98. property bool hoveredStateOn: style.hoveredStateOn
  99. property bool pressedStateOn: style.pressedStateOn
  100. property Image upBackgroundImage: upImage
  101. property Image downBackgroundImage: downImage
  102. property Image leftBackgroundImage: leftImage
  103. property Image rightBackgroundImage: rightImage
  104. property Image sledImage: nullImage
  105. property Image sledImageWhenHovered: nullImage
  106. property Image sledImageWhenPressed: nullImage
  107. //next properties are private ones
  108. property Gradient nullGradient: Gradient{}
  109. property Image nullImage: Image { //this property is "private" don't write it to documentation
  110. id: "null"
  111. source: ""
  112. }
  113. property real contentHeight: 0
  114. property real contentWidth: 0
  115. property int margin: 5
  116. property real heightDifference: 0
  117. property real widthDifference: 0
  118. property real lineHeight: whatismyLineHeight.height
  119. property int lineWidth: 6
  120. property real linesNonVisible: 0
  121. property real columnsNonVisible: 0
  122. property bool freeForScale: false
  123. property int cursorX: 0
  124. property int cursorY: 0
  125. property Image upImage: Image { //this property is "private" don't write it to documentation
  126. id: picUp
  127. source: "../images/arrow_up_50x50.png"
  128. smooth: true
  129. height: lineHeight*0.65
  130. width: lineHeight*0.65
  131. }
  132. property Image downImage: Image { //this property is "private" don't write it to documentation
  133. id: picDown
  134. source: "../images/arrow_down_50x50.png"
  135. smooth: true
  136. height: lineHeight*0.65
  137. width: lineHeight*0.65
  138. }
  139. property Image leftImage: Image { //this property is "private" don't write it to documentation
  140. id: picLeft
  141. source: "../images/arrow_left_50x50.png"
  142. smooth: true
  143. height: lineHeight*0.65
  144. width: lineHeight*0.65
  145. }
  146. property Image rightImage: Image { //this property is "private" don't write it to documentation
  147. id: picRight
  148. source: "../images/arrow_right_50x50.png"
  149. smooth: true
  150. height: lineHeight*0.65
  151. width: lineHeight*0.65
  152. }
  153. // READ ONLY ENDS
  154. signal textChange()
  155. signal cursorPositionChange()
  156. /**
  157. * Relocates the visible area
  158. *
  159. * @return Nothing
  160. */
  161. function reLocate() {
  162. var visibleWidth = (scrollBarVertical.visible)? (textAreaMargin.width-lineHeight) : textAreaMargin.width;
  163. var visibleHeight = (scrollBarHorizontal.visible)? (textAreaMargin.height-lineHeight) : textAreaMargin.height;
  164. var tx = -textArea.x;
  165. var tx2 = -textArea.x + visibleWidth;
  166. var ty = -textArea.y;
  167. var ty2 = -textArea.y + visibleHeight;
  168. if (cursorX < tx) {
  169. if (textArea.cursorPosition == 0) textArea.x = 0;
  170. else textArea.x = -cursorX-5;
  171. }
  172. if (cursorX >= tx2) {
  173. if (textArea.cursorPosition == 0) textArea.x = 0;
  174. else textArea.x = -cursorX + visibleWidth;
  175. }
  176. if (cursorY < ty) {
  177. if (textArea.cursorPosition == 0) textArea.y = 0;
  178. else textArea.y = -cursorY;
  179. }
  180. if (cursorY >= ty2) {
  181. if (textArea.cursorPosition == 0) textArea.y = 0;
  182. else textArea.y = -cursorY + visibleHeight - lineHeight;
  183. }
  184. }
  185. /**
  186. * Checks cursor position
  187. *
  188. * @return Nothing
  189. */
  190. function cursorPos() {
  191. var textClip = textArea.text;
  192. var lastNewLineIndex = 0;
  193. textClip = textClip.substring(0, textArea.cursorPosition);
  194. // y
  195. var clipArray = textClip.split('\n');
  196. var theYPos = ( clipArray.length - 1 ) * lineHeight;
  197. if (!container.horizontalScale) {
  198. var availableContent = textAreaMargin.width;
  199. availableContent = (scrollBarVertical.visible)?(textAreaMargin.width-lineHeight):textAreaMargin.width;
  200. for (var i=0; i < clipArray.length; ++i) {
  201. myWidth.text = clipArray[i];
  202. theYPos += ( Math.floor(myWidth.width / availableContent) * lineHeight);
  203. }
  204. }
  205. container.cursorY = theYPos;
  206. // x
  207. lastNewLineIndex = textClip.lastIndexOf('\n');
  208. whatismyLineHeight.text = textClip.substring((lastNewLineIndex+1), textArea.cursorPosition);
  209. if (!container.horizontalScale) {
  210. var visibleWidth = (scrollBarVertical.visible)? (textAreaMargin.width-lineHeight) : textAreaMargin.width;
  211. container.cursorX = whatismyLineHeight.width % visibleWidth;
  212. } else {
  213. container.cursorX = whatismyLineHeight.width;
  214. }
  215. reLocate();
  216. }
  217. /**
  218. * Updates component when some property has been changed
  219. *
  220. * @return Nothing
  221. */
  222. function updateInfo () {
  223. contentHeight = textArea.height;
  224. heightDifference = contentHeight - textAreaMargin.height;
  225. if (maxLength != -1 && textArea.text.length >= maxLength) {
  226. textArea.text = textArea.text.slice(0,maxLength);
  227. textArea.cursorPosition = maxLength;
  228. }
  229. if (heightDifference <= 0) {
  230. textArea.y = 0;
  231. scrollBarVertical.visible = false;
  232. } else {
  233. linesNonVisible = (horizontalScale)?Math.round(heightDifference/lineHeight)+1:Math.round(heightDifference/lineHeight);
  234. scrollBarVertical.visible = true;
  235. scrollBarVertical.maximum = (linesNonVisible <= 0)?1:linesNonVisible;
  236. scrollBarVertical.value = linesNonVisible;
  237. }
  238. if (horizontalScale) {
  239. contentWidth = (scrollBarVertical.visible)?(textArea.width + lineHeight):textArea.width;
  240. widthDifference = contentWidth - textAreaMargin.width;
  241. if (widthDifference <= 0) {
  242. scrollBarHorizontal.visible = false;
  243. } else {
  244. columnsNonVisible = widthDifference/lineWidth;
  245. scrollBarHorizontal.visible = true;
  246. scrollBarHorizontal.maximum = (columnsNonVisible <= 1)?widthDifference:columnsNonVisible;
  247. }
  248. }
  249. if (freeForScale && !horizontalScale) {
  250. textArea.width = textAreaMargin.width;
  251. if (scrollBarVertical.visible) textArea.width = textAreaMargin.width-lineHeight;
  252. }
  253. }
  254. /**
  255. * Function which can be used to insert text in textarea.
  256. *
  257. * @param insert Text to insert.
  258. * @return nothing
  259. */
  260. function insertText(insert) {
  261. var selection = textArea.selectedText;
  262. var selectionStart = textArea.selectionStart;
  263. var selectionEnd = textArea.selectionEnd;
  264. if (selection == "") {
  265. var cursor = textArea.cursorPosition;
  266. var start = textArea.text.substring(0,cursor);
  267. var end = textArea.text.substring(cursor,textArea.text.length);
  268. var resultText = ""+start+insert+end;
  269. textArea.text = resultText;
  270. textArea.cursorPosition = cursor+1;
  271. } else {
  272. var start = textArea.text.substring(0,selectionStart);
  273. var end = textArea.text.substring(selectionEnd,textArea.text.length);
  274. var resultText = ""+start+insert+end;
  275. textArea.text = resultText;
  276. textArea.cursorPosition = selectionEnd;
  277. }
  278. }
  279. /**
  280. * Function which is used to remove text in text textarea.
  281. */
  282. function removeText() {
  283. var selection = textArea.selectedText;
  284. var selectionStart = textArea.selectionStart;
  285. var selectionEnd = textArea.selectionEnd;
  286. if (selection == "") {
  287. var cursor = textArea.cursorPosition;
  288. if (cursor > 0) {
  289. var cursor = textArea.cursorPosition;
  290. var start = textArea.text.substring(0,cursor-1);
  291. var end = textArea.text.substring(cursor,textArea.text.length);
  292. var resultText = ""+start+end;
  293. textArea.text = resultText;
  294. textArea.cursorPosition = cursor-1;
  295. } else {
  296. textArea.cursorPosition = 0;
  297. }
  298. } else {
  299. var start = textArea.text.substring(0,selectionStart);
  300. var end = textArea.text.substring(selectionEnd,textArea.text.length);
  301. var resultText = ""+start+end;
  302. textArea.text = resultText;
  303. textArea.cursorPosition = selectionStart;
  304. }
  305. }
  306. /**
  307. * Moves cursor to selected direction.
  308. *
  309. * @param direction Direction (in string) where cursor is moving.
  310. * Possible directions are "up","down","left" and "right"
  311. */
  312. function moveCursor (direction) {
  313. var text = textArea.text;
  314. var textClip = text.substring(0, textArea.cursorPosition);
  315. var clipArray = textClip.split('\n');
  316. var allLinesArray = text.split('\n');
  317. if (direction == "up" && clipArray.length > 1) var nextLineIndex = clipArray.length-2;
  318. else if (direction == "down" && clipArray.length < allLinesArray.length) var nextLineIndex = clipArray.length;
  319. else return;
  320. var lastNewLineIndex = 0;
  321. lastNewLineIndex = textClip.lastIndexOf('\n')+1;
  322. textClip = textClip.substring((lastNewLineIndex), textArea.cursorPosition);
  323. var currentPosition = textClip.length;
  324. var nextLineLength = allLinesArray[nextLineIndex].length+1;
  325. if (nextLineIndex < 1) var currentLineLength = allLinesArray[nextLineIndex].length+1;
  326. else var currentLineLength = allLinesArray[nextLineIndex-1].length+1;
  327. var here = 0;
  328. if (direction == "up") {
  329. if (currentPosition < nextLineLength && textArea.cursorPosition < nextLineLength) {
  330. here = textArea.cursorPosition-nextLineLength;
  331. } else if (currentPosition < nextLineLength && 0 < clipArray.length) {
  332. here =textArea.cursorPosition-nextLineLength;
  333. } else {
  334. here = lastNewLineIndex-1;
  335. }
  336. } else if (direction == "down") {
  337. if (currentPosition < nextLineLength) {
  338. here = textArea.cursorPosition+currentLineLength;
  339. } else {
  340. here = lastNewLineIndex+currentLineLength + nextLineLength-1;
  341. }
  342. } else return;
  343. textArea.cursorPosition = here;
  344. }
  345. Component.onCompleted: {
  346. contentHeight = textArea.height;
  347. heightDifference = contentHeight - textAreaMargin.height;
  348. contentWidth = content.length*2;
  349. scrollBarHeight = lineHeight;
  350. if (maxLength != -1 && textArea.text.length >= maxLength) {
  351. textArea.text = textArea.text.slice(0,maxLength);
  352. textArea.cursorPosition = maxLength;
  353. }
  354. if (heightDifference <= 0) {
  355. scrollBarVertical.visible = false;
  356. } else {
  357. linesNonVisible = (horizontalScale)?Math.round(heightDifference/lineHeight)+1:Math.round(heightDifference/lineHeight);
  358. scrollBarVertical.visible = true;
  359. scrollBarVertical.maximum = (linesNonVisible <= 0)?1:linesNonVisible;
  360. contentHeight = textArea.height;
  361. }
  362. if(horizontalScale){
  363. contentWidth = (scrollBarVertical.visible)?(textArea.width + lineHeight):textArea.width;
  364. widthDifference = contentWidth - textAreaMargin.width;
  365. if (widthDifference <= 0) {
  366. scrollBarHorizontal.visible = false;
  367. } else {
  368. columnsNonVisible = widthDifference/lineWidth;
  369. scrollBarHorizontal.visible = true;
  370. scrollBarHorizontal.maximum = (columnsNonVisible <= 1)?widthDifference:columnsNonVisible;
  371. }
  372. }
  373. }
  374. onWidthChanged: {updateInfo()}
  375. onHeightChanged: {updateInfo()}
  376. width: 200
  377. height: 100
  378. color: colorWhenDefault
  379. border{width:borderWidth;color:borderColor}
  380. radius: Functions.countRadius(roundness,width,height,0,1)
  381. TextEdit{
  382. id: whatismyLineHeight
  383. font.pointSize: fontSize
  384. font.family: fontFamily
  385. text: "W"
  386. visible: false
  387. }
  388. TextEdit{
  389. id: myWidth
  390. font.pointSize: fontSize
  391. font.family: fontFamily
  392. text: "W"
  393. visible: false
  394. }
  395. Rectangle{
  396. id: textAreaContainer
  397. width: container.width - container.radius
  398. height: container.height - container.radius
  399. anchors.centerIn: container
  400. color: container.bgColor
  401. clip: true
  402. MouseArea {
  403. id: mouseArea
  404. anchors.fill: parent
  405. onClicked: textArea.focus = true
  406. hoverEnabled: true
  407. }
  408. Rectangle{
  409. id: textAreaMargin
  410. anchors{leftMargin: 4; topMargin: 4; centerIn: textAreaContainer; fill: parent}
  411. color: container.bgColor
  412. clip: true
  413. TextEdit {
  414. id: textArea
  415. onTextChanged: {
  416. updateInfo();
  417. container.textChange();
  418. }
  419. onCursorPositionChanged: {
  420. cursorPos();
  421. container.cursorPositionChange();
  422. }
  423. Component.onCompleted:{
  424. if (text == "" || text == " ") textArea.cursorPosition = 0;
  425. else textArea.cursorPosition = text.length;
  426. if (!horizontalScale) {
  427. textArea.width = textAreaMargin.width;
  428. if (scrollBarVertical.visible) textArea.width = textAreaMargin.width-lineHeight;
  429. }
  430. freeForScale = true;
  431. scrollBarHorizontal.value = 0;
  432. scrollBarVertical.value = 0;
  433. textArea.x = 0;
  434. textArea.y = 0;
  435. }
  436. font.pointSize: fontSize
  437. color: textColor
  438. persistentSelection: false
  439. selectedTextColor: textColorWhenSelected
  440. selectionColor: textAreaColorWhenSelected
  441. text: (content == "")?" ":content
  442. width: if (!horizontalScale) textAreaMargin.width
  443. font.family: fontFamily
  444. wrapMode: (horizontalScale)? TextEdit.WordWrap : TextEdit.WrapAnywhere
  445. readOnly: container.readOnly
  446. selectByMouse:true
  447. }
  448. }
  449. CLScrollBarVertical{
  450. id:scrollBarVertical
  451. onValueChanged: {
  452. textArea.y = -value*lineHeight;
  453. }
  454. anchors.right: textAreaContainer.right
  455. anchors.top: textAreaContainer.top
  456. anchors.bottom: ( scrollBarHorizontal.visible )? scrollBarHorizontal.top : textAreaContainer.bottom;
  457. width: container.scrollBarHeight
  458. visible: false
  459. minimum: 0
  460. maximum: 100
  461. step: 1
  462. clip: true
  463. opacity: 1
  464. buttonRoundness: container.buttonRoundness
  465. sledRoundness: container.sledRoundness
  466. textColor: container.textColor
  467. bgColor: container.scrollBarBgColor
  468. colorWhenDefault: container.colorWhenDefault
  469. colorWhenPressed: container.colorWhenPressed
  470. colorWhenHovered: container.colorWhenHovered
  471. borderColor: container.borderColor
  472. borderColorWhenHovered: container.borderColorWhenHovered
  473. borderColorWhenPressed: container.borderColorWhenPressed
  474. borderColorInner: container.borderColorInner
  475. borderColorInnerWhenHovered: container.borderColorInnerWhenHovered
  476. borderColorInnerWhenPressed: container.borderColorInnerWhenPressed
  477. gradientBg: container.gradientBg
  478. gradientWhenDefault: container.gradientWhenDefault
  479. gradientWhenHovered: container.gradientWhenHovered
  480. gradientWhenPressed: container.gradientWhenPressed
  481. gradientDefaultOn: container.gradientDefaultOn
  482. gradientHoveredOn: container.gradientHoveredOn
  483. gradientPressedOn: container.gradientPressedOn
  484. gradientBgOn: container.gradientBgOn
  485. hoveredStateOn: container.hoveredStateOn
  486. pressedStateOn: container.pressedStateOn
  487. nextBackgroundImage: container.downBackgroundImage
  488. previousBackgroundImage: container.upBackgroundImage
  489. sledImage: container.sledImage
  490. sledImageWhenHovered: container.sledImageWhenHovered
  491. sledImageWhenPressed: container.sledImageWhenPressed
  492. }
  493. CLScrollBar{
  494. id:scrollBarHorizontal
  495. onValueChanged: {
  496. if (columnsNonVisible <= 1) textArea.x = -value*columnsNonVisible;
  497. else textArea.x = -value*lineWidth;
  498. }
  499. anchors.bottom: textAreaContainer.bottom
  500. anchors.right: ( scrollBarVertical.visible )? scrollBarVertical.left : textAreaContainer.right;
  501. anchors.left: textAreaContainer.left
  502. height: container.scrollBarHeight
  503. visible: false
  504. minimum: 0
  505. maximum: 100
  506. opacity: 1
  507. clip: true
  508. buttonRoundness: container.buttonRoundness
  509. sledRoundness: container.sledRoundness
  510. textColor: container.textColor
  511. bgColor: container.scrollBarBgColor
  512. colorWhenDefault: container.colorWhenDefault
  513. colorWhenPressed: container.colorWhenPressed
  514. colorWhenHovered: container.colorWhenHovered
  515. borderColor: container.borderColor
  516. borderColorWhenHovered: container.borderColorWhenHovered
  517. borderColorWhenPressed: container.borderColorWhenPressed
  518. borderColorInner: container.borderColorInner
  519. borderColorInnerWhenHovered: container.borderColorInnerWhenHovered
  520. borderColorInnerWhenPressed: container.borderColorInnerWhenPressed
  521. gradientBg: container.gradientBg
  522. gradientWhenDefault: container.gradientWhenDefault
  523. gradientWhenHovered: container.gradientWhenHovered
  524. gradientWhenPressed: container.gradientWhenPressed
  525. gradientDefaultOn: container.gradientDefaultOn
  526. gradientHoveredOn: container.gradientHoveredOn
  527. gradientPressedOn: container.gradientPressedOn
  528. gradientBgOn: container.gradientBgOn
  529. hoveredStateOn: container.hoveredStateOn
  530. pressedStateOn: container.pressedStateOn
  531. nextBackgroundImage: container.rightBackgroundImage
  532. previousBackgroundImage: container.leftBackgroundImage
  533. sledImage: container.sledImage
  534. sledImageWhenHovered: container.sledImageWhenHovered
  535. sledImageWhenPressed: container.sledImageWhenPressed
  536. }
  537. //next rectangle covers the empty space between scrollbars
  538. Rectangle{
  539. color: container.colorWhenDefault
  540. gradient: (gradientBgOn)?container.gradientBg:container.nullGradient
  541. anchors{ right: textAreaContainer.right; left: scrollBarHorizontal.right; top: scrollBarVertical.bottom; bottom: textAreaContainer.bottom }
  542. visible: (scrollBarHorizontal.visible && scrollBarVertical.visible)?true:false
  543. }
  544. }
  545. }