Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Can I implement a console like Text area in a GUI?
I'm totally new to Qt and C++ so please forgive the noobiness. What I'm trying to do for a project is put a text area in a GUIwith buttons that dictate movement eg. North. Is there a way to create a Text Area that I can put input into and have that inside a GUI? I think using a TextEdit or TextBrowser would be best but I don't know if it's doable. Will I have to use the console and have the GUI buttons separate?
Hi and welcome to devnet,
Your description is not really clear. Looks like a QTextEdit with some QPushButton if you take the widget option. In QML it would be a TextEdit and Buttons.
So all in all, yes you can easily write a GUI with a text edit control and some button.
Maybe with some more details, a more accurate answer could be given.
On a side note, it's Qt, QT stands for Apple QuickTime which you could also be using.
Hey thanks for the reply.
This is what I'm trying to do:
Since my project is based on Zork, I'd like to load up a generic greeting in the textEdit field and then push north to go north etc.
So what your saying is if I use QTextEdit, I can put input into the text edit field and receive output into the text edit field after pushing the GUI buttons?
I've been looking at some of it and does the TextEdit have to be const?
Before going any further, you should first take a look at Qt's tutorials and examples. You'll have a better understanding of what you can do with widgets.
I have had a look at them and they're confusing the crap outta me. Since I can find no example's of textEdit online that doesn't involve reading in from a file, I'm just going to have to struggle on
Did you took a look at the documentation that comes with Qt ?
Yes, I really don't think Qt is very user friendly to beginners
QTextEdit as a "display widget":http://qt-project.org/doc/qt-5/qtextedit.html#using-qtextedit-as-a-display-widget
setText and append are your friends