Commit 1c0a55a9 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

usage

parent 589cc666
Pipeline #91385 passed with stage
in 55 seconds
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.20 as Kirigami
QQC2.ApplicationWindow {
id: root
width: 600 + flickable.leftMargin + flickable.rightMargin
height: 600 + flickable.topMargin + flickable.bottomMargin
color: palette.window
Flickable {
id: flickable
anchors.fill: parent
Kirigami.ScrollHandler {
id: scrollHandler
target: flickable
verticalScrollBar: flickable.QQC2.ScrollBar.vertical
horizontalScrollBar: flickable.QQC2.ScrollBar.horizontal
filterMouseEvents: true
filterKeyEvents: true
}
leftMargin: QQC2.ScrollBar.vertical.mirrored && QQC2.ScrollBar.vertical.visible ?
QQC2.ScrollBar.vertical.implicitWidth : 0
rightMargin: !QQC2.ScrollBar.vertical.mirrored && QQC2.ScrollBar.vertical.visible ?
QQC2.ScrollBar.vertical.implicitWidth : 0
bottomMargin: QQC2.ScrollBar.horizontal.visible ?
QQC2.ScrollBar.horizontal.implicitHeight : 0
QQC2.ScrollBar.vertical: QQC2.ScrollBar {
parent: flickable.parent
anchors.right: flickable.right
anchors.top: flickable.top
anchors.bottom: flickable.bottom
anchors.bottomMargin: flickable.QQC2.ScrollBar.horizontal.height
active: flickable.QQC2.ScrollBar.vertical.active
stepSize: scrollHandler.verticalStepSize / flickable.contentHeight
}
QQC2.ScrollBar.horizontal: QQC2.ScrollBar {
parent: flickable.parent
anchors.left: flickable.left
anchors.right: flickable.right
anchors.bottom: flickable.bottom
anchors.rightMargin: flickable.QQC2.ScrollBar.vertical.width
active: flickable.QQC2.ScrollBar.horizontal.active
stepSize: scrollHandler.horizontalStepSize / flickable.contentWidth
}
contentWidth: grid.implicitWidth
contentHeight: grid.implicitHeight
Grid {
id: grid
columns: Math.sqrt(visibleChildren.length)
Repeater {
model: 1000
delegate: Rectangle {
implicitHeight: 60
implicitWidth: 60
gradient: Gradient {
orientation: index % 2 ? Gradient.Vertical : Gradient.Horizontal
GradientStop { position: 0; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
GradientStop { position: 1; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
}
}
}
}
}
}
import QtQuick 2.15
import QtQuick.Templates 2.15 as T
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.20 as Kirigami
T.ScrollView {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
leftPadding: mirrored && T.ScrollBar.vertical.visible && !Kirigami.Settings.isMobile ? T.ScrollBar.vertical.width : 0
rightPadding: !mirrored && T.ScrollBar.vertical.visible && !Kirigami.Settings.isMobile ? T.ScrollBar.vertical.width : 0
bottomPadding: T.ScrollBar.horizontal.visible && !Kirigami.Settings.isMobile ? T.ScrollBar.horizontal.height : 0
data: [
Kirigami.ScrollHandler {
id: scrollHandler
target: control.contentItem
verticalScrollBar: control.T.ScrollBar.vertical
horizontalScrollBar: control.T.ScrollBar.horizontal
}
]
T.ScrollBar.vertical: QQC2.ScrollBar {
parent: control
x: control.mirrored ? 0 : control.width - width
y: control.topPadding
height: control.availableHeight
active: control.T.ScrollBar.vertical.active
}
T.ScrollBar.horizontal: QQC2.ScrollBar {
parent: control
x: control.leftPadding
y: control.height - height
width: control.availableWidth
active: control.T.ScrollBar.horizontal.active
}
//contentWidth: grid.implicitWidth
// contentHeight: grid.implicitHeight
contentItem: Flickable {
Grid {
id: grid
columns: Math.sqrt(repeater.count)
Repeater {
id: repeater
model: 1000
delegate: Rectangle {
implicitWidth: 60
implicitHeight: 60
gradient: Gradient {
orientation: index % 2 ? Gradient.Vertical : Gradient.Horizontal
GradientStop { position: 0; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
GradientStop { position: 1; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
}
}
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment