Get data from text file and send to text entry field
-
Is there something within Qt tools?
-
Is there something within Qt tools?
@JacobNovitsky
What would there be in "tools"? Assuming you mean you want this behaviour in code, just read some text from a text file and set it in whatever widget. -
@JacobNovitsky
What would there be in "tools"? Assuming you mean you want this behaviour in code, just read some text from a text file and set it in whatever widget.@JonB how to do so?
I'm making AutoHotKey analog, when I press lets say ctrl + T, I want to send some text from file to field (webrowser text field, command line text field, or word document text field)
-
@JonB how to do so?
I'm making AutoHotKey analog, when I press lets say ctrl + T, I want to send some text from file to field (webrowser text field, command line text field, or word document text field)
@JacobNovitsky
QByteArray QIODevice::readLine(qint64 maxSize = 0) on aQFile
, or otherread()
.void QTextEdit::setPlainText(const QString &text) or whatever.
-
@JacobNovitsky
QByteArray QIODevice::readLine(qint64 maxSize = 0) on aQFile
, or otherread()
.void QTextEdit::setPlainText(const QString &text) or whatever.
@JonB oh, sure, I know QFile :) I need to get data from that string and PASTE somewhere (in MS Word document)
upd:
setPlainText seem to be that solution, I am right? -
@JonB oh, sure, I know QFile :) I need to get data from that string and PASTE somewhere (in MS Word document)
upd:
setPlainText seem to be that solution, I am right?@JacobNovitsky
All you wrote initially was title ofGet data from text file and send to text entry field
Do you think other people would know from that you are asking about pasting into a Word document? :)
PASTE somewhere (in MS Word document)
Do you mean paste into a running Word instance? That has nothing to do with a Qt widget....
If you want to paste into external programs under Windows that has little to do with Qt. Maybe you can ask for paste at Windows text cursor position in any application, but I wouldn't have thought so. I don't know how AutoHotKey does whatever it does.
-
@JacobNovitsky
All you wrote initially was title ofGet data from text file and send to text entry field
Do you think other people would know from that you are asking about pasting into a Word document? :)
PASTE somewhere (in MS Word document)
Do you mean paste into a running Word instance? That has nothing to do with a Qt widget....
If you want to paste into external programs under Windows that has little to do with Qt. Maybe you can ask for paste at Windows text cursor position in any application, but I wouldn't have thought so. I don't know how AutoHotKey does whatever it does.
What I want to accomplish:
[0] I set cursor to web browser or sublime text editor or forum text form
[1] I press Ctrl+T
[2] call some function which gets QWindow or QWidget
[3] choose between lines 1-10 -> choose line 3
[4] it gets line 3 containt from text filethen, line 4 contains must be PASTED In any application where you can possibly write or paste text (has cursor)
So it proceeds PASTE (Ctrl V) but you did not really used Ctrl+C before
It copies from my text file which holds needed texthttps://www.maketecheasier.com/assets/uploads/2020/11/Text-Expansion-QuickTextPaste-Success.jpg
-
What I want to accomplish:
[0] I set cursor to web browser or sublime text editor or forum text form
[1] I press Ctrl+T
[2] call some function which gets QWindow or QWidget
[3] choose between lines 1-10 -> choose line 3
[4] it gets line 3 containt from text filethen, line 4 contains must be PASTED In any application where you can possibly write or paste text (has cursor)
So it proceeds PASTE (Ctrl V) but you did not really used Ctrl+C before
It copies from my text file which holds needed texthttps://www.maketecheasier.com/assets/uploads/2020/11/Text-Expansion-QuickTextPaste-Success.jpg
@JacobNovitsky said in Get data from text file and send to text entry field:
So it proceeds PASTE (Ctrl V) but you did not really used Ctrl+C before
Have you looked at QClipboard Class ?
The clipboard offers a simple mechanism to copy and paste data between applications.