-2

Is there any way to build an image map with qml (qt quick) components directly without importing html code?And I want to it's coordinates be same as html imagemap's coordinates(I dont want to recalculate my image map coords). and my shape is rectangular.tnx

Addr3ss
  • 21
  • 4
  • Your question is not clear, you could show that it is what you are currently doing and that is what you want to do. – eyllanesc Sep 01 '17 at 02:49

1 Answers1

1

No, there is no way. MouseAreas are always rectangular.

You would need to provide a some kind of collision detection function, to check whether your click happened inside of your object, described by the coordinates.

For this you can implement any of the algorithmns out there, in a way, that it supports your coordinate format. The right choice depends on the characteristics of your objects, like:

  • Is it a circle?
  • Is it a regular shape?
  • Is it convex?
  • Is it concave?

There are many good pages on collision detection, though a performant implementation might be tricky - especially in QtQuicks JS, so you probably want to do it in C++.

Another shot you might take, is dropping your coordinates, and produce masks that can be used with the solution provided here: https://stackoverflow.com/a/38177820/2056452 (coming from an official example)

  • 1
    Then please clarify your question, in an manner, that I can understand it. Provide some code, that shows what you have tried, or at least how you imagine it to work. – derM - not here for BOT dreams Sep 01 '17 at 07:42
  • @Addr3ss Well, it seems like no one understood your question correctly. Please, try to clarify/improve it so someone - even the very same derM - can step up and correctly answer it. – BaCaRoZzo Sep 02 '17 at 09:48