Qt World Summit: Register Today!

Generate Android UI protoype, using c++ with Qt

  • I have an xml file that contains ui components and their respective parameters like position, coordinates , how can i use this xml file to generate an Andrioid UI prototype by c++?.

  • Moderators

    That depends on the structure of that file. if it is a Qt .ui file, then you just need to plug it into any Qt GUI project and it will work.

    If you have an android UI file, then it is intended for Android's Java parser. To make it work in C++, you would have to choose a framework to work with, then transcode the XML to something that that framework understands

  • @sierdzio My program is a QT application and by Android ui file do you the xml layout?

  • Moderators

    I mean that XML is versatile and a lot of languages, frameworks and system use it to define interfaces. I do not know in which format your XML file is saved, so I also can't tell you how to convert it to C++. And I do not know why you need it: Qt already has 2 built-in UI frameworks (QtWidgets and QtQuick) which can be used not only to prototype, but also actually develop applications on Android.

  • @sierdzio Yeh u r right , my xml file is a simple layout that has been created from an image that contains sketched UI components, and i want to create an Android UI prototype using the information saved in this xml file, could you guide me on this as how i can generate UI code using Qt?

  • Moderators

    No, sorry, you are just too vague.

    You can use QXmlStreamReader to parse your XML. Then, how you continue, is entirely up to you.

    Myself, I would just use QML and QtQuick to rapidly prototype the application. It's a great tool for such purposes.

  • @sierdzio Sorry my bad, i mean i want to programmatically generate Android UI prototype