Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
QML Comprobación del cruce de elementos con diferentes padres

Tengo muchos elementos del mismo tipo (Point.qml) en diferentes niveles de anidamiento. ¿Cómo puedo verificar que algún elemento (id: checker) cruza uno de estos elementos (Punto)?

Por ejemplo:

 // Point.qml import QtQuick 2.0 Rectangle { width: 10 height: 10 color: "black" }
 // main.qml import QtQuick 2.11 import QtQuick.Window 2.11 import QtQuick.Layouts 1.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: area; anchors.fill: parent RowLayout { anchors.fill: parent Repeater { model: 5 Rectangle { width: Math.random()*150+50 height: Math.random()*150+50 color: "blue" Point { x : Math.random()*parent.width y : Math.random()*parent.height } } } Point { x : Math.random()*parent.width y : Math.random()*parent.height } } Point { x : Math.random()*parent.width y : Math.random()*parent.height } Rectangle { id: checker width: 60 height: 60 color: "red" opacity: 0.5 MouseArea { anchors.fill: parent drag.target: parent onReleased: { var point = getCoveredPoint() if (point) { console.log("Point ", point, " is covered") } } function getCoveredPoint() { var point // do something return point } } } } }

En este ejemplo, cuando el Rectángulo rojo (id: verificador) se detiene en el Punto negro, se debe enviar un mensaje a la consola. Los puntos y el "verificador" están en el mismo elemento principal (id: área)

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda