Results 1 to 7 of 7

Thread: templates / Q_OBJECT question

Threaded View

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

    Default Re: templates / Q_OBJECT question

    I admit I haven't read the whole post, but it looks like templates are not for you - you can't decide which class to create during runtime, the template argument has to be specified during compilation. But if you think templates are for you, then make some object that is not derived from QObject and make it a member of your class - QObjects can't be templates, but they can have a member pointer that is a base class of a template class.

    Qt Code:
    1. class ... {
    2. Base *x;
    3. };
    4.  
    5. class Base{};
    6. template .... class X : public Base {...};
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to wysota for this useful post:

    _borker_ (19th December 2007)

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.