Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
GUI Rendering from Text
I have a text file which specifies all the GUI components, along with its title and names.
I need to parse the text file and render it using Qt.
Presently, I have only parsed it using 'yacc and lex' ...
Is there any other modules in Qt which offers the same functionality!!?
How can I do it best and efficiently!!?
Three things come to mind: QUiLoader and QML, and of course HTML. All work on text-like formats, but all have their own format. What is your ultimate goal? Do you have control over the format of the files that you need to "parse"?
No, I cant change the format. Can I convert the 'text format' that I have to the XML format required by Qt..?? How can I do that?
qlalr is used for parsing in a lot of places inside Qt and related tools. That is hardly documented though and require a lot of understanding of parser theory.
The sources are part of Qt itself IIRC.
It qlalr used for converting my format to xml!!?
Also how good it is to use the classic yacc and lex?
qlalr is a parser generator, thus is basically a tool like yacc.
What do I have to do if I have to convert the text file ( the present format) to the required XML(.ui format)
Awaiting your reply...
Well... you could start by creating a form in designer that contains the types of widgets you are going to have to support, and study its structure. Or... you could just parse the file yourself and create the requried widgets from code directly. I have no idea what would be easier in your case, as you did not tell us anything about your file format and requirements.
Thanks for the Reply
Well., the format is simple... There is a hierarchy... Parent Widgets and child widgets... Each widget is described by the basic characteristics like label,rect coordinates, font(for texts) etc...!!
And also.., How feasible it is to use the generated yyparse() in my source code!!?
To parse the file myself, what tools does Qt offer.., I can use regular expressions for labels.., but what about the yacc equivalent!!? :-o
I have a parser written using both lex and yacc.. I m happy to see these 'tags' available... But I m not sure how to use it..
Can someone please explain how i can go about using it!!?
koahnig last edited by
Can you elaborate a bit, how this is related to Qt?
[Edit: Context was not clear prior to merge ]
Well., I wanted to render a GUI which described in a text file. For which I had to write a parser and link the structure with my UI toolkit(Qt)
At present, I have the parser files(yacc and lex) but I m not sure how I ll make it work...
I came across a useful link, but culd really make much out of what was written
I have merged your topics on the same issue. Please use a single topic for a single issue.