Results 1 to 11 of 11

Thread: QThread usage and exec()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Posts
    14
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: QThread usage and exec()

    I guess I'm not expert enough to say that I'm certain, but I'm pretty sure. Perhaps you can provide a sanity check for me...

    The server class is declared like so:
    Qt Code:
    1. class Xorbz_Game : public QThread
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. Xorbz_Game( class Xorbz* parent );
    7. ~Xorbz_Game( void );
    To copy to clipboard, switch view to plain text mode 
    etc...

    The client (main app) instantiates the server like so:
    Qt Code:
    1. // Instantiate a new game engine
    2. currentGame = new Xorbz_Game( this );
    To copy to clipboard, switch view to plain text mode 

    After the client sets a few things in the server via member functions, it starts things up like this:
    Qt Code:
    1. // Start the game running
    2. currentGame->start();
    To copy to clipboard, switch view to plain text mode 

    Anything look amiss?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QThread usage and exec()

    Quote Originally Posted by smahnken View Post
    Anything look amiss?
    No, you must block the main event loop in some other way. Do you have any loops in your GUI code?

  3. #3
    Join Date
    Aug 2008
    Posts
    14
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: QThread usage and exec()

    No loops in my GUI code, but maybe I'm chasing the wrong thing. I'm probably doing something wrong with the graphics. I found that if I resize the window, or minimize/restore it, the graphics do update, but only while I'm resizing.

    The whole project is a migration effort from the QT 3.x series, in which the code base used the QCanvas and QPixmapArray stuff. I'm now trying to establish the same functionality with the QT 4.x series.

    I'll go poke around (and read) some more with the new graphics structure. I know there's the whole update() thing, but there's a good chance I've got something wrong there. I'll start a new discussion thread once I've got some substantiated questions.

    Thanks again for your help!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QThread usage and exec()

    Are you sure you need threads at all?

Tags for this Thread

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.