Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderView.qml
Show First 20 Lines • Show All 478 Lines • ▼ Show 20 Line(s) | 191 | MouseEventListener { | |||
---|---|---|---|---|---|
479 | 479 | | |||
480 | PlasmaExtras.ScrollArea { | 480 | PlasmaExtras.ScrollArea { | ||
481 | id: scrollArea | 481 | id: scrollArea | ||
482 | 482 | | |||
483 | anchors.fill: parent | 483 | anchors.fill: parent | ||
484 | 484 | | |||
485 | focus: true | 485 | focus: true | ||
486 | 486 | | |||
487 | readonly property int viewportWidth: viewport ? Math.ceil(viewport.width) : 0 | ||||
488 | readonly property int viewportHeight: viewport ? Math.ceil(viewport.height) : 0 | ||||
489 | | ||||
487 | GridView { | 490 | GridView { | ||
488 | id: gridView | 491 | id: gridView | ||
489 | 492 | | |||
490 | property bool isRootView: false | 493 | property bool isRootView: false | ||
491 | 494 | | |||
492 | property int iconSize: makeIconSize() | 495 | property int iconSize: makeIconSize() | ||
493 | property int verticalDropHitscanOffset: 0 | 496 | property int verticalDropHitscanOffset: 0 | ||
494 | 497 | | |||
Show All 12 Lines | |||||
507 | 510 | | |||
508 | property variant cachedRectangleSelection: null | 511 | property variant cachedRectangleSelection: null | ||
509 | 512 | | |||
510 | currentIndex: -1 | 513 | currentIndex: -1 | ||
511 | 514 | | |||
512 | keyNavigationWraps: false | 515 | keyNavigationWraps: false | ||
513 | boundsBehavior: Flickable.StopAtBounds | 516 | boundsBehavior: Flickable.StopAtBounds | ||
514 | 517 | | |||
518 | function calcExtraSpacing(cellSize, containerSize) { | ||||
519 | var availableColumns = Math.floor(containerSize / cellSize); | ||||
520 | var extraSpacing = 0; | ||||
521 | if (availableColumns > 0) { | ||||
522 | var allColumnSize = availableColumns * cellSize; | ||||
523 | var extraSpace = Math.max(containerSize - allColumnSize); | ||||
524 | extraSpacing = extraSpace / availableColumns; | ||||
525 | } | ||||
526 | return extraSpacing; | ||||
hein: Coding style: missing termination semicolae (also elsewhere) | |||||
527 | } | ||||
528 | | ||||
529 | readonly property int iconWidth: iconSize + (2 * units.largeSpacing) + (2 * units.smallSpacing) | ||||
530 | readonly property real extraWidth: calcExtraSpacing(iconWidth, scrollArea.viewportWidth) | ||||
515 | cellWidth: { | 531 | cellWidth: { | ||
516 | if (root.useListViewMode) { | 532 | if (root.useListViewMode) { | ||
517 | return gridView.width; | 533 | return gridView.width; | ||
534 | } else if (root.isContainment) { | ||||
535 | return iconWidth + extraWidth; | ||||
536 | } else { | ||||
537 | return iconWidth; | ||||
518 | } | 538 | } | ||
Why it used (6 * units.smallSpacing) it makes more space at bottom? It should be same as iconwidth calculation, about me. I see you not change it, but it should. anthonyfieroni: Why it used (6 * units.smallSpacing) it makes more space at bottom? It should be same as… | |||||
You can use padding (or right/top/bottom/left padding), we depend to Qt 5.6 now, anthonyfieroni: You can use padding (or right/top/bottom/left padding), we depend to Qt 5.6 now, | |||||
Fairly certain was smallSpacing * 2 + iconSize + smallSpacing * 2 + defaultFont.height * lines + smallSpacing * 2 Right now:
So it's actually: smallSpacing | frame | smallSpacing*2 | icon | smallSpacing | text | smallSpacing*2 Zren: Fairly certain was `smallSpacing * 2` + `iconSize` + `smallSpacing * 2` + `defaultFont.height *… | |||||
519 | | ||||
520 | return iconSize + (2 * units.largeSpacing) + (2 * units.smallSpacing); | | |||
521 | } | 539 | } | ||
hein: readonly (also elsewhere) | |||||
522 | 540 | | |||
541 | readonly property int iconHeight: (iconSize + (theme.mSize(theme.defaultFont).height * plasmoid.configuration.textLines) + (6 * units.smallSpacing)) | ||||
542 | readonly property real extraHeight: calcExtraSpacing(iconHeight, scrollArea.viewportHeight) | ||||
523 | cellHeight: { | 543 | cellHeight: { | ||
524 | if (root.useListViewMode) { | 544 | if (root.useListViewMode) { | ||
525 | return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) | 545 | return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) | ||
526 | + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | 546 | + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | ||
527 | listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; | 547 | listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; | ||
548 | } else if (root.isContainment) { | ||||
549 | return iconHeight + extraHeight; | ||||
550 | } else { | ||||
551 | return iconHeight; | ||||
528 | } | 552 | } | ||
529 | | ||||
530 | return (iconSize + (theme.mSize(theme.defaultFont).height * plasmoid.configuration.textLines) | | |||
531 | + (6 * units.smallSpacing)); | | |||
532 | } | 553 | } | ||
533 | 554 | | |||
534 | delegate: FolderItemDelegate { | 555 | delegate: FolderItemDelegate { | ||
535 | width: gridView.cellWidth | 556 | width: gridView.cellWidth | ||
536 | height: gridView.cellHeight | 557 | height: gridView.cellHeight | ||
537 | } | 558 | } | ||
538 | 559 | | |||
539 | onContentXChanged: { | 560 | onContentXChanged: { | ||
▲ Show 20 Lines • Show All 716 Lines • Show Last 20 Lines |
Coding style: missing termination semicolae (also elsewhere)