Creating interface for terminal
-
I've a client server app in which the server side can interact with the /bin/sh of client side. I've build and tested the client side and now client can receive & process /bin/sh commands and sends back the output.
On server side, I have created a naive interface which will mimic the client terminal interface somehow. The interface seems like the below (for now)
I've used TextInput for input of commands.
I've these questions in mind:
-
Which element should I use for the output window ?
-
When I press enter after input command, the command should appear in the output window.
-
The corresponding receive text (from the client) should appear after the command in the output window.
-
Output window should automatically slide if the text fills the windows just like terminal/cmd.
I'm new to GUI/QML so ignore my ignorance.
Any guidance/help would be appreciated.
Thanks
-
-
- QTextEdit in read-only mode
- Just append it to the QTextEdit
- Same as 2 but for the text you receive
- Do you mean scroll? It is already there in QTextEdit
Oh, just realized you're asking about QML - forget my reply :-)
-
In QML, i'm using ScrollView along the TextArea to view the input commands and output.
I'm facing two problems here:
-
The TextArea doesn't scroll down automatically, i want the ScrollView to show me the latest output so that i doesn't have to scroll down manually to see it.
-
I'm unable to change the TextArea background color. The background I want to be transparent so that it reflects the main windows background.
ScrollView { id: view anchors.fill: parent TextArea { id: outputTxt color: "black" readOnly: true selectByMouse: true text: "TextArea\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n" anchors.fill: parent } }
-