Results 1 to 10 of 10

Thread: API in C++ with Qt4 GUI

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    19
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Re: API in C++ with Qt4 GUI

    Hello again ,
    I want acess updated data from xpto Class/Thread.


    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. QtInterface w;
    5. Test *xpto;
    6. ....
    7. QTimer *timer = new QTimer(&a);
    8. a.connect(timer, SIGNAL(timeout()), &a, SLOT(w.dostuff(xpto)));
    9. timer->start(5000);
    10. ....
    11. }
    To copy to clipboard, switch view to plain text mode 
    Is this supose to call the SLOT in Qt.cpp every 5 sec., passing updated xpto?
    Because i tested with timers in Qt.cpp and is working perfectly.
    In Main.cpp isn't working.

    Do i have to use a timer in Main.cpp and use another timer in Qt.cpp to update QTableWidgetItem?
    How should i config both timers? (if needed)

    Thanks.
    Last edited by pytro; 23rd January 2007 at 11:34.

  2. #2
    Join Date
    Dec 2006
    Posts
    19
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Exclamation Re: API in C++ with Qt4 GUI

    Found the reason:

    To start an event loop from a non-GUI thread, use QThread::exec()..

    I think...

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.