Results 1 to 13 of 13

Thread: subclassing/inheritance QObject problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: subclassing/inheritance QObject problem

    Try running "qmake && make".

  2. #2
    Join Date
    Feb 2006
    Location
    Knoxville, TN
    Posts
    14
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: subclassing/inheritance QObject problem

    oh yes, I've done that many times hoping I just needed a new Makefile, but no luck.

  3. #3
    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: subclassing/inheritance QObject problem

    Aren't you missing the HEADERS variable from your .pro file?

  4. #4
    Join Date
    Feb 2006
    Location
    Knoxville, TN
    Posts
    14
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: subclassing/inheritance QObject problem

    Hmm. Everything works fine when I take out the Qobject subclass and macro, with the .pro file as it is. Is a HEADERS variable something additional that's needed when I create my own subclass with QOBJECT?

  5. #5
    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: subclassing/inheritance QObject problem

    Quote Originally Posted by cbeall1
    Is a HEADERS variable something additional that's needed when I create my own subclass with QOBJECT?
    qmake scans header files for Q_OBJECT macro and when it finds one it adds a rule to the Makefile that such file should be processed with moc program. In other words, if you don't put your headers in HEADERS variable, moc won't be run and you will get "undefined reference to vtable" errors.

  6. #6
    Join Date
    Feb 2006
    Location
    Knoxville, TN
    Posts
    14
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    2

    Talking Re: subclassing/inheritance QObject problem

    AWESOME! Problem solved. Thanks jacek!
    I still get the warnings on /qucom_p as shown above. Are those something I need to be concerned about that could cause me trouble in the future?

  7. #7
    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: subclassing/inheritance QObject problem

    Quote Originally Posted by cbeall1
    I still get the warnings on /qucom_p as shown above. Are those something I need to be concerned about that could cause me trouble in the future?
    http://www.qtcentre.org/forum/showthread.php?t=266

Similar Threads

  1. Possibly an inheritance problem with QObject?
    By chadkeck in forum Qt Programming
    Replies: 8
    Last Post: 5th November 2008, 01:26
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  3. Problem with my object hierarchy
    By rage in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2007, 09:18
  4. Can't create an object : initialisation problem ?
    By Nyphel in forum Qt Programming
    Replies: 5
    Last Post: 12th March 2007, 09:07
  5. Problem with Destructor of QObject
    By mikro in forum Qt Programming
    Replies: 5
    Last Post: 9th July 2006, 19:05

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.