don't use bindings but a connection

to update position and value, removes binding loop warnings
This commit is contained in:
Marco Martin 2012-07-31 10:36:25 +02:00
parent 1180b5831d
commit 4a1fa1a491
2 changed files with 30 additions and 5 deletions

View File

@ -140,9 +140,33 @@ Item {
}
}
// FIXME: there's a binding loop occurrence here somewhere...(RangeModel) : property: value
// try flicking a view with a scrollbar in it, and flick it past it's contents
// a few times and try using the mousewheel..you'll find the warning then..
Connections {
target: flickableItem
onContentYChanged: {
if (internalLoader.isVertical) {
range.value = flickableItem.contentY
}
}
onContentXChanged: {
if (!internalLoader.isVertical) {
range.value = flickableItem.contentX
}
}
}
Connections {
target: internalLoader.item.handle
onYChanged: {
if (internalLoader.isVertical) {
range.position = internalLoader.item.handle.y
}
}
onXChanged: {
if (!internalLoader.isVertical) {
range.position = internalLoader.item.handle.x
}
}
}
RangeModel {
id: range
@ -168,7 +192,7 @@ Item {
internalLoader.item.contents.width - internalLoader.item.handle.width
}
}
value: internalLoader.isVertical ? flickableItem.contentY : flickableItem.contentX
onValueChanged: {
if (flickableItem.moving) {
return
@ -181,7 +205,6 @@ Item {
}
}
position: internalLoader.isVertical ? internalLoader.item.handle.y : internalLoader.item.handle.x
onPositionChanged: {
if (internalLoader.item.mouseArea && internalLoader.item.mouseArea.pressed) {

View File

@ -59,6 +59,8 @@
#include <QAccessible>
#endif
#include <QDebug>
#include "qrangemodel.h"
#include "qrangemodel_p.h"