Skip to content

Instantly share code, notes, and snippets.

@mitchcurtis
Created June 27, 2019 09:24
Show Gist options
  • Save mitchcurtis/96cd4b0c0acabd3b595237a5508124bd to your computer and use it in GitHub Desktop.
Save mitchcurtis/96cd4b0c0acabd3b595237a5508124bd to your computer and use it in GitHub Desktop.
Gradient Rectangle in Flickable with reparented attached ScrollBars
import QtQuick 2.12
import QtQuick.Controls 2.12
ApplicationWindow {
visible: true
width: 640
height: 480
Flickable {
id: flickable
clip: true
anchors.fill: parent
anchors.rightMargin: ScrollIndicator.vertical.width
anchors.bottomMargin: ScrollIndicator.horizontal.height
contentWidth: rectangle.width
contentHeight: rectangle.height
ScrollIndicator.horizontal: ScrollIndicator {
parent: flickable.parent
anchors.left: flickable.left
anchors.right: flickable.right
anchors.top: flickable.bottom
}
ScrollIndicator.vertical: ScrollIndicator {
parent: flickable.parent
anchors.top: flickable.top
anchors.left: flickable.right
anchors.bottom: flickable.bottom
}
Rectangle {
id: rectangle
width: 1000
height: 1000
gradient: Gradient {
GradientStop {
position: 0
color: "navajowhite"
}
GradientStop {
position: 1
color: "salmon"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment