Results 1 to 3 of 3

Thread: Simulate enter key and more

  1. #1
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Question Simulate enter key and more

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Simulate enter key and more

    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.

  3. #3
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: Simulate enter key and more

    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
    Last edited by davinciomare; 26th September 2016 at 10:13.

Similar Threads

  1. How to simulate QTouchEvent using mouse
    By dpatel in forum Qt Programming
    Replies: 5
    Last Post: 28th April 2016, 01:40
  2. Replies: 1
    Last Post: 7th August 2015, 09:06
  3. Simulate left and right clicks?
    By hakermania in forum Newbie
    Replies: 5
    Last Post: 8th June 2011, 11:44
  4. Simulate QMenu behavior
    By Remenic in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2009, 19:48
  5. Replies: 1
    Last Post: 14th September 2008, 23:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.