Results 1 to 8 of 8

Thread: Call Non-static method on static method

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    82
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Call Non-static method on static method

    all your threads run the worker function so why don't you subclass QThread and put the code from the worker function into the run function of your customThread
    then in your loop do something like:
    for (i = 0; i < threadCount; i++)
    {
    customThread* thread = new customThread(this);
    threadList.append(thread);
    thread->start();
    }

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Call Non-static method on static method

    it looks absurd.

    Why are you using win api for threads in a Qt class when Qt provides cross platform support for threads?

    CreateThread is not portable, and is more clunky and difficult to use than QThread. Why aren't you using QThread?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. C++ method call
    By ^NyAw^ in forum General Programming
    Replies: 4
    Last Post: 19th November 2011, 12:19
  2. How to emit signal from static method?
    By kusumat in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2011, 09:17
  3. Replies: 6
    Last Post: 15th April 2010, 20:02
  4. Why can't I call base public method?
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2009, 20:37
  5. Static field and public method
    By probine in forum General Programming
    Replies: 1
    Last Post: 5th March 2006, 11:02

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.