答案 0 :(得分:3)
您可以使用Controls.2中的PathInterpolator。下面的示例是一些select sysdate as current_date,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-1 end as prev_weekday1,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-2 end as prev_weekday2,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-3 end as prev_weekday3,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-4 end as prev_weekday4,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-5 end as prev_weekday5
from dual
修改,您可以根据需要采用它:
Slider
答案 1 :(得分:1)
您可以使用Flickable
来查看自己的观点。对于Flickable
,您可以选择ScrollBar
来设置样式。
设置此ScrollBar
样式有点棘手,因为它的某些属性是废话。
position
- 属性,记录为
此属性保存滚动条的位置,缩放为0.0 - 1.0。
将永远不会到达1.0
,除非,句柄大小为0.但是,您实际上无法设置句柄的大小。它会自动调整大小。因此,如果您不希望手柄完全填充ScrollBar
的宽度,则需要使用Item
作为基础并在其中添加视觉,因此您拥有主权试。
总之,它可能看起来像这样:
Flickable {
anchors.fill: parent
contentWidth: width
contentHeight: mainWindow.height * 10
Rectangle {
width: 640
height: mainWindow.height * 10
gradient: Gradient {
GradientStop { color: 'orchid'; position: 0 }
GradientStop { color: 'orange'; position: 1 }
}
}
ScrollBar.vertical: ScrollBar {
id: scrollBar
width: 50
contentItem: Item {
// This will deal with the bullshit of the position. Imperfect, as I do not consider any margins/paddings
property real normalizedPosition: scrollBar.position * (scrollBar.height / (scrollBar.height - height))
Rectangle {
// Draw the curve by defining a function for x in dependance of the position.
x: Math.sin(Math.PI * parent.normalizedPosition) * 40
width: 10
height: parent.height // I use the default height, so it
// really goes from top to bottom.
// A smaller height means, you should
// also alter the y value to have a
// more natural behavior.
radius: 5
color: 'green'
Text {
text: parent.parent.normalizedPosition
}
}
}
}
}