fix scroll node cannot scroll
This commit is contained in:
parent
3207cc2581
commit
7950416ba6
@ -11,8 +11,8 @@ ScrollView {
|
|||||||
|
|
||||||
property var tag: "Scroller"
|
property var tag: "Scroller"
|
||||||
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOn
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
@ -37,11 +37,27 @@ ScrollView {
|
|||||||
console.log(tag, uuid + " onHeightChanged: " + this.height)
|
console.log(tag, uuid + " onHeightChanged: " + this.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseArea {
|
onImplicitWidthChanged: {
|
||||||
// anchors.fill: parent
|
console.log(tag, uuid + " onImplicitWidthChanged: " + this.implicitWidth)
|
||||||
// onClicked: {
|
}
|
||||||
// console.log(tag, uuid + " wrapper: " + wrapper)
|
|
||||||
// mouseAreaBridge.onClick(wrapper)
|
onImplicitHeightChanged: {
|
||||||
// }
|
console.log(tag, uuid + " onImplicitHeightChanged: " + this.implicitHeight)
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
onContentWidthChanged: {
|
||||||
|
console.log(tag, uuid + " onContentWidthChanged: " + this.contentWidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
onContentHeightChanged: {
|
||||||
|
console.log(tag, uuid + " onContentHeightChanged: " + this.contentHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
console.log(tag, uuid + " wrapper: " + wrapper)
|
||||||
|
mouseAreaBridge.onClick(wrapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ ApplicationWindow {
|
|||||||
width: 200
|
width: 200
|
||||||
height: 200
|
height: 200
|
||||||
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOn
|
||||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
@ -44,17 +44,14 @@ ApplicationWindow {
|
|||||||
console.log(tag, uuid + " onHeightChanged: " + this.height)
|
console.log(tag, uuid + " onHeightChanged: " + this.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
Rectangle {
|
||||||
anchors.fill: parent
|
implicitWidth: 400
|
||||||
onClicked: {
|
implicitHeight: 400
|
||||||
console.log(tag, uuid + " wrapper: " + wrapper)
|
|
||||||
mouseAreaBridge.onClick(wrapper)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "ABC"
|
text: "ABC"
|
||||||
font.pixelSize: 224
|
font.pixelSize: 124
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,11 @@ TextArea {
|
|||||||
|
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
|
||||||
|
leftPadding: 0
|
||||||
|
topPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
|
||||||
property int textAlignment: 0
|
property int textAlignment: 0
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
@ -72,7 +72,10 @@ void DoricScrollerNode::afterBlended(QJsonValue jsValue) {
|
|||||||
mChildNode->init(this);
|
mChildNode->init(this);
|
||||||
mChildNode->blend(props);
|
mChildNode->blend(props);
|
||||||
|
|
||||||
mChildNode->getNodeView()->setParentItem(parent);
|
QQmlListProperty<QQuickItem> contentChildren =
|
||||||
|
qvariant_cast<QQmlListProperty<QQuickItem>>(
|
||||||
|
parent->property("contentChildren"));
|
||||||
|
contentChildren.append(&contentChildren, mChildNode->getNodeView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -81,13 +84,24 @@ void DoricScrollerNode::afterBlended(QJsonValue jsValue) {
|
|||||||
mChildNode->init(this);
|
mChildNode->init(this);
|
||||||
mChildNode->blend(props);
|
mChildNode->blend(props);
|
||||||
|
|
||||||
mChildNode->getNodeView()->setParentItem(parent);
|
QQmlListProperty<QQuickItem> contentChildren =
|
||||||
|
qvariant_cast<QQmlListProperty<QQuickItem>>(
|
||||||
|
parent->property("contentChildren"));
|
||||||
|
contentChildren.append(&contentChildren, mChildNode->getNodeView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoricScrollerNode::requestLayout() {
|
void DoricScrollerNode::requestLayout() {
|
||||||
this->mChildNode->requestLayout();
|
this->mChildNode->requestLayout();
|
||||||
getLayouts()->apply(mView->width(), mView->height());
|
DoricLayouts *layout = (DoricLayouts *)(mChildNode->getNodeView()
|
||||||
|
->property("doricLayout")
|
||||||
|
.toULongLong());
|
||||||
|
if (layout != nullptr) {
|
||||||
|
layout->apply(mView->width(), mView->height());
|
||||||
|
|
||||||
|
mView->setProperty("contentWidth", layout->getMeasuredWidth());
|
||||||
|
mView->setProperty("contentHeight", layout->getMeasuredHeight());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoricScrollerNode::blendSubNode(QJsonValue subProperties) {
|
void DoricScrollerNode::blendSubNode(QJsonValue subProperties) {
|
||||||
|
@ -204,6 +204,7 @@ void DoricLayouts::measureContent(qreal targetWidth, qreal targetHeight) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem *parent = this->view->parentItem();
|
QQuickItem *parent = this->view->parentItem();
|
||||||
|
if (parent != nullptr) {
|
||||||
DoricLayouts *parentDoricLayout =
|
DoricLayouts *parentDoricLayout =
|
||||||
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
|
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
|
||||||
if (parentDoricLayout != nullptr) {
|
if (parentDoricLayout != nullptr) {
|
||||||
@ -218,6 +219,7 @@ void DoricLayouts::measureContent(qreal targetWidth, qreal targetHeight) {
|
|||||||
setMeasuredHeight(0);
|
setMeasuredHeight(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoricLayouts::measureUndefinedContent(qreal targetWidth,
|
void DoricLayouts::measureUndefinedContent(qreal targetWidth,
|
||||||
@ -464,7 +466,8 @@ void DoricLayouts::setFrame() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "DoricLayouts: " << tag << this->view->property("uuid")
|
qCritical() << "DoricLayouts setProperty: " << tag
|
||||||
|
<< this->view->property("uuid")
|
||||||
<< " measuredWidth: " << this->measuredWidth
|
<< " measuredWidth: " << this->measuredWidth
|
||||||
<< " measuredHeight: " << this->measuredHeight
|
<< " measuredHeight: " << this->measuredHeight
|
||||||
<< " width: " << this->view->width()
|
<< " width: " << this->view->width()
|
||||||
@ -707,12 +710,16 @@ void DoricLayouts::setMeasuredWidth(qreal measuredWidth) {
|
|||||||
<< " measuredWidth: " << this->measuredWidth;
|
<< " measuredWidth: " << this->measuredWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal DoricLayouts::getMeasuredWidth() { return this->measuredWidth; }
|
||||||
|
|
||||||
void DoricLayouts::setMeasuredHeight(qreal measuredHeight) {
|
void DoricLayouts::setMeasuredHeight(qreal measuredHeight) {
|
||||||
this->measuredHeight = measuredHeight;
|
this->measuredHeight = measuredHeight;
|
||||||
qCritical() << "DoricLayouts: " << tag << this->view->property("uuid")
|
qCritical() << "DoricLayouts: " << tag << this->view->property("uuid")
|
||||||
<< " measuredHeight: " << this->measuredHeight;
|
<< " measuredHeight: " << this->measuredHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal DoricLayouts::getMeasuredHeight() { return this->measuredHeight; }
|
||||||
|
|
||||||
void DoricLayouts::setMeasuredX(qreal measuredX) {
|
void DoricLayouts::setMeasuredX(qreal measuredX) {
|
||||||
this->measuredX = measuredX;
|
this->measuredX = measuredX;
|
||||||
qCritical() << "DoricLayouts: " << tag << this->view->property("uuid")
|
qCritical() << "DoricLayouts: " << tag << this->view->property("uuid")
|
||||||
|
@ -84,6 +84,9 @@ public:
|
|||||||
|
|
||||||
void apply();
|
void apply();
|
||||||
|
|
||||||
|
qreal getMeasuredWidth();
|
||||||
|
qreal getMeasuredHeight();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString tag;
|
QString tag;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user