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

119
Vistas
¿Por qué el siguiente código comienza a comportarse mal si se hace clic con el mouse varias veces?

Problema: El siguiente es un programa qt qml. Estoy usando la versión qt6. en repetidos clics del mouse, el programa comienza a comportarse incorrectamente. La rotación en cada inicio después de hacer clic con el mouse continúa con velocidad reducida. Lo que está causando errores en este código, que me parece perfecto.

A continuación se muestra un programa qt qml. Estoy usando la versión qt6. en repetidos clics del mouse, el programa comienza a comportarse incorrectamente. La rotación en cada inicio después de hacer clic con el mouse continúa con velocidad reducida. Lo que está causando errores en este código, que me parece perfecto.

 import QtQuick Window { width: Screen.width height: Screen.height visible: true title: qsTr("Firki") property int globalFrom: 0 Image { anchors.fill: parent source: "qrc:/images/background.png" Image { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter height: parent.height / 2 source: "qrc:/images/pole.png" } Image { id: firki anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter source: "qrc:/images/pinwheel.png" RotationAnimation on rotation { id: rotatefirki loops: rotateblurredfirki.loops duration: rotateblurredfirki.duration from: rotateblurredfirki.from to: rotateblurredfirki.to running: rotateblurredfirki.running } } Image { id: blurredfirki anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter source: "qrc:/images/blur.png" opacity: 0 RotationAnimation on rotation { id: rotateblurredfirki loops: Animation.Infinite duration: 1000 from: globalFrom to: 360 running: false } } } MouseArea { anchors.fill: parent onClicked: { if(!rotateblurredfirki.running) { rotateblurredfirki.restart() blurredfirki.opacity = 1 } else { rotateblurredfirki.stop() globalFrom = Math.floor(blurredfirki.rotation) blurredfirki.opacity = 0 } } } }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Creo que la propiedad en paused te será útil aquí. Primero vincule la propiedad paused de rotatefirki a la propiedad de rotarborrosafirki.

 RotationAnimation on rotation { id: rotatefirki ... paused: rotateblurredfirki.paused }

Luego, cambie el controlador de clic del mouse para alternar la propiedad en pausa:

 MouseArea { anchors.fill: parent onClicked: { if(!rotateblurredfirki.running) { // Not running, so start the animation rotateblurredfirki.restart() } else { // Keep it running, but pause it rotateblurredfirki.paused = !rotateblurredfirki.paused blurredfirki.opacity = 1 - blurredfirki.opacity } } }
about 4 years ago · Juan Pablo Isaza Denunciar
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