# Help for a newbie: Qt c++ and Tiled

**URL:** <https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927>\
**Category:** Questions\
**Created:** [May 15, 2019, 8:17pm UTC](https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927 "2019-05-15T20:17:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@Nicolas](https://discourse.mapeditor.org/u/Nicolas)\
**Post date:** [May 15, 2019, 8:17pm UTC](https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927/1 "2019-05-15T20:17:12Z")

</div>

Hi guys,

I am quite new to Qt and I need to create a 2D game, I used the Tiled tool which is great to make my map. But I really don’t understand how to read and display that map in my Qt project, even though I checked the github already, it seems rather complicated for what I have to do. Please any help would be great, but as I told you I am quite new to this. I am doing an AI project to train a model to play the game and win.

Thanks

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [May 15, 2019, 8:24pm UTC](https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927/2 "2019-05-15T20:24:35Z")

</div>

Did you check out the [TMX Viewer](https://github.com/bjorn/tiled/tree/master/src/tmxviewer) application in the Tiled repository? It’s a small example of how you could use libtiled to load and render a map based on [`QGraphicsView`](https://doc.qt.io/qt-5/qgraphicsview.html).

Good luck with your project!

---

<div class="post-metadata">

**Author:** ![Nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@Nicolas](https://discourse.mapeditor.org/u/Nicolas)\
**Post date:** [May 15, 2019, 8:42pm UTC](https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927/3 "2019-05-15T20:42:25Z")

</div>

Thanks for your answer, I cloned the git and tried to understand a bit of the code, but I don’t unfortunately.  
I did not manage to use QXmlSimpleReader to read my map, but I don’t see how I am suppose to use the TMXviewer either…  
why is it launching Tiled when running?  
Maybe I am better off trying to create the map directly on qt don’t you think? I am really a beginner.

Thanks

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [May 16, 2019, 7:25pm UTC](https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927/4 "2019-05-16T19:25:49Z")

</div>

> [@Nicolas](#):
>
> why is it launching Tiled when running?

Because Tiled is the main application in the project, and the only one for which a run configuration is created by default. If you want to run the TMX Viewer:

- Go to Projects mode
- Click the “Run” item under your active Kit
- At “Run configuration” on the right, click the “Add” button and choose “tmxviewer”
- Now clicking the Run button should launch the TMX Viewer

> [@Nicolas](#):
>
> Maybe I am better off trying to create the map directly on qt don’t you think? I am really a beginner.

Of course you may be better off learning a bit more about Qt first, and possibly using QGraphicsView or maybe even just QPainter to draw your map.

---

<div class="post-metadata">

**Author:** ![Nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@Nicolas](https://discourse.mapeditor.org/u/Nicolas)\
**Post date:** [May 16, 2019, 9:53pm UTC](https://discourse.mapeditor.org/t/help-for-a-newbie-qt-c-and-tiled/3927/5 "2019-05-16T21:53:29Z")

</div>

Thank you for those usefull details, I managed to make it work !  
thank you for the tool and for the answers !
