PDA

View Full Version : Simulate enter key and more



davinciomare
26th September 2016, 01:38
Hi i need to simulate in one file these actions:
Like enter .. etc .. the actions between 0 and 32 numbers in the ascii table.

So for example if i check that i press enter, i create enter in my text file. Normally when i do this, the file show me some Strange event o symbol like these:
http://i.imgsafe.org/7e29fc31bc.png

So i want to simulate the effect, not the event or like this content.

I create other post because this question is about other problem but if somebody are angry i could take more care the next time. Thanks in advance.

anda_skoa
26th September 2016, 09:14
Since you are posting this in a Qt forum, I assume you are asking about sending a QKeyEvent.

1) Create a QKeyEvent using Qt::Key_Enter for the "key" argument
2) use QCoreApplication::sendEvent() or QCoreApplication::postEvent() to send the event to any widget.

Cheers,
_

P.S.: and you have needlessly posted an image instead of text again.

davinciomare
26th September 2016, 10:13
iI need when me press enter key, in the table ascii 13 numbers, do a end line. Something like this.

if(num==13){
log.open(QFile::Append);
log.write("\n");//Jump the line in textfile
log.close();

}
But something working thx;

Added after 9 minutes:

this is solved thx it is very easy