Results 1 to 2 of 2

Thread: ACE Thread and QT signal or event

  1. #1

    Smile Re: ACE Thread and QT signal or event

    I create a TCP server use ACE.
    I use an ace thread (ACE_Task) to receive messages from client.

    what I want to do IS:

    when a message arrived,I want to show it on the main window (QMainWindow)

    In QT, we could use signal to connect a QThread and a QMainWindow,
    but I use ACE thread, which is not a QObject drived type,
    so I can't use connect to connect an ACE thread with QMainWindow.

    Are there any solutions to this problem?

    Thank you gurus


    Added after 1 16 minutes:


    I have found the solution
    just as bellow:

    class CMyThread: public QObject,public ACE_Task<ACE_MT_SYNCH>
    {
    };

    problem solved.
    Last edited by opengllove; 27th December 2013 at 04:17.

  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: ACE Thread and QT signal or event

    Just for completness

    an alternative way of invoking slots in a different thread is by using QMetaObject::invokeMethod and connection type Qt::QueuedConnection.

    For example invoking QLabel::setText() from a different thread
    Qt Code:
    1. QMetaObject::invokeMethod( pointerToLabel, "setText", Qt::QueuedConnection, Q_ARG( QString, text ) );
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. How to immediately post an event/signal to another thread
    By mortoray in forum Qt Programming
    Replies: 0
    Last Post: 8th December 2010, 13:33
  2. Replies: 9
    Last Post: 28th November 2009, 20:31
  3. event or thread
    By damien in forum Qt Programming
    Replies: 6
    Last Post: 3rd October 2008, 17:43
  4. Thread+send event
    By Fastman in forum Qt Programming
    Replies: 20
    Last Post: 1st August 2007, 14:09
  5. Main Thread Event loop
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 12:10

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.