Changeset View
Changeset View
Standalone View
Standalone View
src/controls/templates/OverlaySheet.qml
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Line(s) | 204 | function updateContentWidth() { | |||
---|---|---|---|---|---|
216 | contentItem.contentItem.x = (mainItem.width - newWidth)/2 | 216 | contentItem.contentItem.x = (mainItem.width - newWidth)/2 | ||
217 | contentItem.contentItem.width = newWidth; | 217 | contentItem.contentItem.width = newWidth; | ||
218 | ownSizeUpdate = false; | 218 | ownSizeUpdate = false; | ||
219 | } | 219 | } | ||
220 | onContentItemMaximumWidthChanged: updateContentWidth() | 220 | onContentItemMaximumWidthChanged: updateContentWidth() | ||
221 | onWidthChanged: updateContentWidth() | 221 | onWidthChanged: updateContentWidth() | ||
222 | Connections { | 222 | Connections { | ||
223 | target: typeof contentItem.contentItem === "undefined" ? null : contentItem.contentItem | 223 | target: typeof contentItem.contentItem === "undefined" ? null : contentItem.contentItem | ||
224 | onWidthChanged: { | 224 | function onWidthChanged() { | ||
225 | if (!mainItem.ownSizeUpdate) { | 225 | if (!mainItem.ownSizeUpdate) { | ||
226 | mainItem.updateContentWidth(); | 226 | mainItem.updateContentWidth(); | ||
227 | } | 227 | } | ||
228 | } | 228 | } | ||
229 | } | 229 | } | ||
230 | onHeightChanged: { | 230 | onHeightChanged: { | ||
231 | var focusItem; | 231 | var focusItem; | ||
232 | 232 | | |||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | 398 | property int extraMargin: (!root.parent || | |||
401 | !applicationWindow().controlsVisible || | 401 | !applicationWindow().controlsVisible || | ||
402 | (applicationWindow().pageStack && applicationWindow().pageStack.globalToolBar && applicationWindow().pageStack.globalToolBar.actualStyle === ApplicationHeaderStyle.ToolBar) || | 402 | (applicationWindow().pageStack && applicationWindow().pageStack.globalToolBar && applicationWindow().pageStack.globalToolBar.actualStyle === ApplicationHeaderStyle.ToolBar) || | ||
403 | (applicationWindow().header && applicationWindow().header.toString().indexOf("ToolBarApplicationHeader") === 0)) | 403 | (applicationWindow().header && applicationWindow().header.toString().indexOf("ToolBarApplicationHeader") === 0)) | ||
404 | ? 0 : Units.gridUnit * 3 | 404 | ? 0 : Units.gridUnit * 3 | ||
405 | Connections { | 405 | Connections { | ||
406 | target: scrollView.flickableItem | 406 | target: scrollView.flickableItem | ||
407 | onContentYChanged: footerItem.y = Math.min(mainItem.height, mainItem.mapFromItem(flickableContents, 0, flickableContents.height).y) - footerItem.height; | 407 | onContentYChanged: footerItem.y = Math.min(mainItem.height, mainItem.mapFromItem(flickableContents, 0, flickableContents.height).y) - footerItem.height; | ||
408 | 408 | | |||
409 | onHeightChanged: scrollView.flickableItem.contentYChanged() | 409 | function onHeightChanged() { | ||
410 | scrollView.flickableItem.contentYChanged() | ||||
411 | } | ||||
410 | } | 412 | } | ||
411 | z: 2 | 413 | z: 2 | ||
412 | Item { | 414 | Item { | ||
413 | id: footerParent | 415 | id: footerParent | ||
414 | implicitHeight: footer ? footer.implicitHeight : 0 | 416 | implicitHeight: footer ? footer.implicitHeight : 0 | ||
415 | anchors { | 417 | anchors { | ||
416 | top: parent.top | 418 | top: parent.top | ||
417 | left: parent.left | 419 | left: parent.left | ||
Show All 32 Lines | 445 | FocusScope { | |||
450 | y: (scrollView.contentItem != flickableContents ? -scrollView.flickableItem.contentY - listHeaderHeight - (headerItem.visible ? headerItem.height : 0): 0) | 452 | y: (scrollView.contentItem != flickableContents ? -scrollView.flickableItem.contentY - listHeaderHeight - (headerItem.visible ? headerItem.height : 0): 0) | ||
451 | 453 | | |||
452 | width: mainItem.contentItemPreferredWidth <= 0 ? mainItem.width : Math.max(mainItem.width/2, Math.min(mainItem.contentItemMaximumWidth, mainItem.contentItemPreferredWidth)) | 454 | width: mainItem.contentItemPreferredWidth <= 0 ? mainItem.width : Math.max(mainItem.width/2, Math.min(mainItem.contentItemMaximumWidth, mainItem.contentItemPreferredWidth)) | ||
453 | 455 | | |||
454 | height: (scrollView.contentItem != flickableContents ? scrollView.flickableItem.contentHeight + listHeaderHeight : (root.contentItem.height + topPadding + bottomPadding)) + (headerItem.visible ? headerItem.height : 0) + (footerItem.visible ? footerItem.height : 0) | 456 | height: (scrollView.contentItem != flickableContents ? scrollView.flickableItem.contentHeight + listHeaderHeight : (root.contentItem.height + topPadding + bottomPadding)) + (headerItem.visible ? headerItem.height : 0) + (footerItem.visible ? footerItem.height : 0) | ||
455 | Connections { | 457 | Connections { | ||
456 | target: enabled ? flickableContents.Window.activeFocusItem : null | 458 | target: enabled ? flickableContents.Window.activeFocusItem : null | ||
457 | enabled: flickableContents.focus && flickableContents.Window.activeFocusItem && flickableContents.Window.activeFocusItem.hasOwnProperty("text") | 459 | enabled: flickableContents.focus && flickableContents.Window.activeFocusItem && flickableContents.Window.activeFocusItem.hasOwnProperty("text") | ||
458 | onTextChanged: { | 460 | function onTextChanged() { | ||
459 | if (Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height > mainItem.Window.height) { | 461 | if (Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height > mainItem.Window.height) { | ||
460 | scrollView.flickableItem.contentY += (Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height) - mainItem.Window.height | 462 | scrollView.flickableItem.contentY += (Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height) - mainItem.Window.height | ||
461 | } | 463 | } | ||
462 | } | 464 | } | ||
463 | } | 465 | } | ||
464 | 466 | | |||
465 | Item { | 467 | Item { | ||
466 | id: contentItemParent | 468 | id: contentItemParent | ||
Show All 33 Lines | |||||
500 | Binding { | 502 | Binding { | ||
501 | target: scrollView.verticalScrollBar ? scrollView.verticalScrollBar.anchors : null | 503 | target: scrollView.verticalScrollBar ? scrollView.verticalScrollBar.anchors : null | ||
502 | property: "rightMargin" | 504 | property: "rightMargin" | ||
503 | value: mainItem.width - flickableContents.width - flickableContents.x | 505 | value: mainItem.width - flickableContents.width - flickableContents.x | ||
504 | } | 506 | } | ||
505 | 507 | | |||
506 | Connections { | 508 | Connections { | ||
507 | target: scrollView.flickableItem | 509 | target: scrollView.flickableItem | ||
508 | onContentHeightChanged: { | 510 | function onContentHeightChanged() { | ||
509 | if (openAnimation.running) { | 511 | if (openAnimation.running) { | ||
510 | openAnimation.running = false; | 512 | openAnimation.running = false; | ||
511 | open(); | 513 | open(); | ||
512 | } | 514 | } | ||
513 | } | 515 | } | ||
514 | onDraggingChanged: { | 516 | function onDraggingChanged() { | ||
515 | if (scrollView.flickableItem.dragging) { | 517 | if (scrollView.flickableItem.dragging) { | ||
516 | return; | 518 | return; | ||
517 | } | 519 | } | ||
518 | 520 | | |||
519 | //close | 521 | //close | ||
520 | if ((mainItem.height + scrollView.flickableItem.contentY) < mainItem.height/2) { | 522 | if ((mainItem.height + scrollView.flickableItem.contentY) < mainItem.height/2) { | ||
521 | closeAnimation.to = -mainItem.height; | 523 | closeAnimation.to = -mainItem.height; | ||
522 | closeAnimation.running = true; | 524 | closeAnimation.running = true; | ||
523 | 525 | | |||
524 | } else if ((mainItem.height*0.6 + scrollView.flickableItem.contentY) > scrollView.flickableItem.contentHeight) { | 526 | } else if ((mainItem.height*0.6 + scrollView.flickableItem.contentY) > scrollView.flickableItem.contentHeight) { | ||
525 | closeAnimation.to = scrollView.flickableItem.contentHeight; | 527 | closeAnimation.to = scrollView.flickableItem.contentHeight; | ||
526 | closeAnimation.running = true; | 528 | closeAnimation.running = true; | ||
527 | } | 529 | } | ||
528 | } | 530 | } | ||
529 | } | 531 | } | ||
530 | 532 | | |||
531 | Binding { | 533 | Binding { | ||
532 | target: scrollView.verticalScrollBar | 534 | target: scrollView.verticalScrollBar | ||
533 | property: "visible" | 535 | property: "visible" | ||
534 | value: scrollView.flickableItem.contentHeight > mainItem.height*0.8 | 536 | value: scrollView.flickableItem.contentHeight > mainItem.height*0.8 | ||
535 | } | 537 | } | ||
536 | Connections { | 538 | Connections { | ||
537 | target: scrollView.verticalScrollBar | 539 | target: scrollView.verticalScrollBar | ||
538 | onActiveChanged: { | 540 | function onActiveChanged() { | ||
539 | if (!scrollView.verticalScrollBar.active) { | 541 | if (!scrollView.verticalScrollBar.active) { | ||
540 | scrollView.flickableItem.movementEnded(); | 542 | scrollView.flickableItem.movementEnded(); | ||
541 | } | 543 | } | ||
542 | } | 544 | } | ||
543 | } | 545 | } | ||
544 | ScrollView { | 546 | ScrollView { | ||
545 | id: scrollView | 547 | id: scrollView | ||
546 | anchors.fill: parent | 548 | anchors.fill: parent | ||
547 | horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff | 549 | horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff | ||
548 | rightPadding: 0 | 550 | rightPadding: 0 | ||
549 | } | 551 | } | ||
550 | } | 552 | } | ||
551 | } | 553 | } |