Hi i want to make some findpath app i am using QML and i don't know how to implement this because i don't know how makes node from QML grid. But i have some problems with implement algorithm. Can somebody give me some advices or links.
Thanks
Hi i want to make some findpath app i am using QML and i don't know how to implement this because i don't know how makes node from QML grid. But i have some problems with implement algorithm. Can somebody give me some advices or links.
Thanks
Any help? i simply don't know how to make from QML grid something like tree or graph and how to sent it to c++ class.
How do you generate grid?
the best approach is to use GridView. Data model and A* algorithm I would implement in C++.
yes i will implement A* algorithm in C++ but have you some source or example ??? It will help me a lot
Thanks for help
What do you need example for?
Try to subdivide your task to a series of simpler task, then you can easily google it/look it up in reference.
1. How to implement A* in C++ (http://code.activestate.com/recipes/...ath-algorithm/).
2. How to expose C++ classes to QML (http://qt-project.org/doc/qt-5.0/qtq...ttributes.html).
3. How to dynamically generate QML elements (http://kunalmaemo.blogspot.ru/2011/0...ically-on.html).
I want some example how to use A* algorithm with QML GridLayout
OK, I don't think there's particular example or specific component in qt for that.
Try to do it yourself, start with simple QML - C++ calls, then implement graph structure in QML (for example add to your node objects references to neighbors).
Then you can expose these elements to C++, or you can serialize them and send to C++.
After calculating shortest path you can return it as a list of identifiers for example.
Be creative, every complex task is just a number of simple tasks, don't be afraid to write some code!
Hi yesterday i start code and i do this but i dont know what with walls i dont know how to go back i somebody will look my code and help me i will happy
Code: A-StarTest01.zip
ok i make it otherwise :
but this algorthm dont know how go backQt Code:
pathFind = false; openList.clear(); QQuickItem *currentItem = start; QList<QQuickItem*> path; openList.append(start); while(!openList.isEmpty()) { findNeighbors(currentItem); QQuickItem *minimal = openList.first(); foreach (QQuickItem *item, openList) { int minF = getF(currentItem, minimal); int itemF = getF(currentItem, item); if(itemF < minF) { minimal = item; } } openList.removeOne(start); closedList.append(currentItem); currentItem = minimal; path.append(currentItem); if(currentItem == finish) { pathFind = true; drawPath(path); } } qDebug() << (pathFind ? "path finded" : "no path"); }To copy to clipboard, switch view to plain text mode
Bookmarks