| Summary: | Add the property childrenRect to QMLItem | ||
|---|---|---|---|
| Product: | [Unmaintained] QmlWeb | Reporter: | Igor A. <igor.andruszkiewicz> |
| Component: | QtQuick | Assignee: | Anton Kreuzkamp <akreuzkamp> |
| Status: | RESOLVED UNMAINTAINED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Other | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Igor A.
2015-11-23 13:11:33 UTC
It works fine but I don't know how to update internally read only property yet.
Here are my changes:
1) function computing the Rect
function updateChildrenRect(component){
var children = component !== undefined ? component.children : undefined
if ( children == undefined || children.length == 0 )
return;
var maxWidth = 0;
var maxHeight = 0;
var minX = children.length>0 ? children[0].x : 0;
var minY = children.length>0 ? children[0].y : 0;
var h=0;
var w=0;
for(var i in children){
var child = children[i];
h = child.$isUsingImplicitHeight !== 0 ? child.implicitHeight : child.height;
w = child.$isUsingImplicitWidth !== 0 ? child.implicitWidth : child.width;
maxWidth = Math.max(maxWidth, child.x + w);
maxHeight = Math.max(maxHeight, child.y + h);
minX = Math.min(minX, child.x);
minY = Math.min(minX, child.y);
}
component.childrenRect.x = minX;
component.childrenRect.y = minY;
component.childrenRect.width = maxWidth;
component.childrenRect.height = maxHeight;
}
2) above to be called from updateVGeometry and updateHGeometry
if (this.parent != undefined) updateChildrenRect(this.parent);
3) and a childrenRect property for QMLItem
this.childrenRect = new QObject(this);
createSimpleProperty("real", this.childrenRect, "x","rw"); //todo ro
createSimpleProperty("real", this.childrenRect, "y","rw"); // todo ro
createSimpleProperty("real", this.childrenRect, "width","rw"); // todo ro
createSimpleProperty("real", this.childrenRect, "height","rw"); // todo ro
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved. This project is unfortunately no longer maintained. If a new maintainer wants to step up and take care, the project is archived here: https://invent.kde.org/unmaintained/qmlweb You can just clone it in your private namespace on invent.kde.org and if you have started to work on it and fixed/implemented something get it reviewed and the project unarchived. Sorry for the inconveniences. |