Results 1 to 4 of 4

Thread: Q_DECLARE_METATYPE(T); error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2014
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Q_DECLARE_METATYPE(T); error

    source file

    #include "message.h"

    Message::Message()
    {
    }

    Message::Message(const Message &other)
    {
    name_=other.name_;
    }

    Message::~Message()
    {

    }

    Message::Message(const QString &name)
    {
    setName(name);
    }

    QString Message::getName() const
    {
    return name_;
    }

    void Message::setName(const QString &name)
    {
    name_ = name;
    }
    After some search on google, I had found the solution in other similar issue.. link

    it seems that i need to include a header file of QMetaType, which the tutorial didnt mention about it. Strange thing macro is still defined without the header file..

    thank anyway!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Q_DECLARE_METATYPE(T); error

    Quote Originally Posted by SentaVera View Post
    Strange thing macro is still defined without the header file..
    It is not. Which is the error you got.

    Because the compiler saw a function declaration, function name Q_DECLARE_METATYPE, one argument of type Message, but missing return type.
    So it complained about the missing return type, said it would assume it and warning you that this is not specified standard behavior.

    Cheers,
    _

Similar Threads

  1. Avoiding Q_DECLARE_METATYPE
    By moijhd in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2013, 10:09
  2. Q_DECLARE_METATYPE() questions.
    By hickscorp in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2010, 16:04
  3. Problem to declare a stl map - Q_DECLARE_METATYPE
    By Althor in forum Qt Programming
    Replies: 5
    Last Post: 9th December 2008, 09:41
  4. How to use Q_DECLARE_METATYPE
    By lni in forum Qt Programming
    Replies: 6
    Last Post: 21st July 2008, 17:13
  5. Q_DECLARE_METATYPE and qVariantCanConvert
    By manojmka in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2008, 06:13

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.