Results 1 to 2 of 2

Thread: Accessing TextEdit from a thread.

  1. #1
    Join Date
    Nov 2008
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Accessing TextEdit from a thread.

    Hi,
    I am beginner in Qt.. I have created a GUI with Qt Designer 3.3. I start a QThread when I press a button in the GUI. The thread works fine but now I want the thread to append text in a TextEdit widget on my GUI. I tried this method below to connect my signal to the slot but I get the error that : QueuedConnection' is not a member of `Qt'

    void Form1::ImportFile() // On pressing Start Button
    {
    ImportThread *IThread = new ImportThread;
    QObject::connect (IThread,SIGNAL(mysignal(QString)), textEdit1, SLOT(append(QString)), Qt::QueuedConnection);
    ....
    }
    can anyone help me?
    Thanks,
    dsmcc.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Accessing TextEdit from a thread.

    i) Qt::QueuedConnection was introduced with Qt4. Bad luck.
    ii) accessing a QTextEdit from a different thread is not allowed
    (queued signals would be ok (they are not really accessing it directly), but in your case: not available)

    You have to upgrade Qt, or deliver a custom event or do real threads programming (with synchronization etc).

    The easiest way is to use Qt4, if possible.

Similar Threads

  1. GUI and non-GUI thread problem
    By dimaz in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2008, 21:25
  2. Accessing data from a worker thread
    By steg90 in forum Qt Programming
    Replies: 20
    Last Post: 25th May 2007, 10:20
  3. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  4. Replies: 10
    Last Post: 20th March 2007, 22:19
  5. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49

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
  •  
Qt is a trademark of The Qt Company.