Changeset View
Changeset View
Standalone View
Standalone View
src/controls/PageRow.qml
Show First 20 Lines • Show All 504 Lines • ▼ Show 20 Line(s) | 325 | //END FUNCTIONS | |||
---|---|---|---|---|---|
505 | Component { | 505 | Component { | ||
506 | id: containerComponent | 506 | id: containerComponent | ||
507 | 507 | | |||
508 | MouseArea { | 508 | MouseArea { | ||
509 | id: container | 509 | id: container | ||
510 | height: mainView.height | 510 | height: mainView.height | ||
511 | width: root.width | 511 | width: root.width | ||
512 | state: page ? (!root.wideMode ? "vertical" : (container.level >= pagesLogic.count - 1 ? "last" : "middle")) : ""; | 512 | state: page ? (!root.wideMode ? "vertical" : (container.level >= pagesLogic.count - 1 ? "last" : "middle")) : ""; | ||
513 | acceptedButtons: Qt.LeftButton | Qt.BackButton | Qt.ForwardButton | ||||
513 | 514 | | |||
514 | property int level | 515 | property int level | ||
515 | 516 | | |||
516 | readonly property int hint: page && page.implicitWidth ? page.implicitWidth : root.defaultColumnWidth | 517 | readonly property int hint: page && page.implicitWidth ? page.implicitWidth : root.defaultColumnWidth | ||
517 | readonly property int roundedHint: Math.floor(root.width/hint) > 0 ? root.width/Math.floor(root.width/hint) : root.width | 518 | readonly property int roundedHint: Math.floor(root.width/hint) > 0 ? root.width/Math.floor(root.width/hint) : root.width | ||
518 | 519 | | |||
519 | property Item page | 520 | property Item page | ||
520 | property Item owner | 521 | property Item owner | ||
521 | onPageChanged: { | 522 | onPageChanged: { | ||
522 | if (page) { | 523 | if (page) { | ||
523 | owner = page.parent; | 524 | owner = page.parent; | ||
524 | page.parent = container; | 525 | page.parent = container; | ||
525 | page.anchors.fill = container; | 526 | page.anchors.fill = container; | ||
526 | } | 527 | } | ||
527 | } | 528 | } | ||
528 | drag.filterChildren: true | 529 | drag.filterChildren: true | ||
529 | onClicked: root.currentIndex = level; | 530 | onClicked: { | ||
531 | switch (mouse.button) { | ||||
532 | case Qt.BackButton: | ||||
533 | root.flickBack(); | ||||
534 | break; | ||||
535 | case Qt.ForwardButton: | ||||
536 | root.currentIndex = Math.min(root.depth, root.currentIndex + 1); | ||||
537 | break; | ||||
538 | default: | ||||
539 | root.currentIndex = level; | ||||
540 | break; | ||||
541 | } | ||||
542 | } | ||||
530 | onFocusChanged: { | 543 | onFocusChanged: { | ||
531 | if (focus) { | 544 | if (focus) { | ||
532 | root.currentIndex = level; | 545 | root.currentIndex = level; | ||
533 | } | 546 | } | ||
534 | } | 547 | } | ||
535 | 548 | | |||
536 | Separator { | 549 | Separator { | ||
537 | z: 999 | 550 | z: 999 | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |