我正在尝试在 Qt 5.15.2 下构建一个具有自定义几何形状的示例项目(https://doc-snapshots.qt.io/qt6-dev/qtquick3d-customgeometry-example.html)我绘制了所有 qml ui 元素,除了对于网格。在 Qt 6 中一切正常并且网格被渲染。
我在上面附加的链接中看到该示例引用了 Qt 6,但是 QQuick3DGeometry 类为我们提供了 Qt5 中存在的自定义几何图形。请告诉我是否有机会使用 Qt 5.15 来渲染具有自定义几何形状的网格,以及 QQuick3DGeometry 在这种情况下是否有帮助。先感谢您。
我得到以下代码,它循环遍历所有子项。我需要获取迭代次数,以便将其与子项总数进行比较。一旦循环处于最后一次迭代,就需要单击“下一步”按钮,以便打开新页面。
cy.get('[data-automation="AssetGrids_GridItemContainer_div"]').each(
($element, index) => {
cy.get('[data-automation="AssetGrids_GridItemContainer_div"]').then(
(listing) => {
const listingCount = Cypress.$(listing).length;
cy.log('Number of elements: ' + listingCount);
}
);
if (listingCount !=== index-1) {
// Do some magic here if it's not the last iteration
}
});
Run Code Online (Sandbox Code Playgroud)
我不确定这个解决方案是否正确,并且不会两次使用相同的定位器引发任何问题。有没有什么方法可以获取仅声明循环的找到元素的数量,以避免使用它?
cy.get('[data-automation="AssetGrids_GridItemContainer_div"]').then(
(listing) => {
const listingCount = Cypress.$(listing).length;
cy.log('Number of elements: ' + listingCount);
}
Run Code Online (Sandbox Code Playgroud)