Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QT 5.2.0: Q_DECLARE_METATYPE requires value_type and other sequential class attributes to be defined
QtWS25 Last Chance

[SOLVED] QT 5.2.0: Q_DECLARE_METATYPE requires value_type and other sequential class attributes to be defined

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John.Curious
    wrote on last edited by
    #1

    I have a code that compiles and runs fine under QT 5.1.1. After upgrading to QT 5.2.0, I got errors:

    @
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1372) : error C2039: 'value_type' : is not a member of 'MyTemplateClass<T>'
    with
    [
    T=float
    ]
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1578) : see reference to class template instantiation 'QtPrivate::SequentialContainerConverterHelper<T>' being compiled
    with
    [
    T=MyTemplateClassFlt
    ]
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1600) : see reference to function template instantiation 'int qRegisterNormalizedMetaType<T>(const QByteArray &,T *,QtPrivate::MetaTypeDefinedHelper<T,defined>::DefinedType)' being compiled
    with
    [
    T=MyTemplateClassFlt,
    defined=true
    ]
    d:\users\vlad\vsprojects\qt\cmpt\libcc\libcct\MyTemplateClass.h(736) : see reference to function template instantiation 'int qRegisterMetaType<MyTemplateClassFlt>(const char *,T *,QtPrivate::MetaTypeDefinedHelper<T,defined>::DefinedType)' being compiled
    with
    [
    T=MyTemplateClassFlt,
    defined=true
    ]
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1372) : error C2146: syntax error : missing ',' before identifier 'value_type'
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1372) : error C2065: 'value_type' : undeclared identifier
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1382) : error C2955: 'QMetaTypeId2' : use of class template requires template argument list
    c:\qt\qt5.2.0\5.2.0\msvc2012_64\include\qtcore\qmetatype.h(1479) : see declaration of 'QMetaTypeId2'

    @
    These errors are generated from the line:
    @
    typedef MyTemplateClass<float> MyTemplateClassFlt; Q_DECLARE_METATYPE(MyTemplateClassFlt)
    @

    MyTemplateClass is a simple template class which is not based on a sequential container. Why 5.2.0's Q_DECLARE_METATYPE now requires "T::value_type" and other attributes of sequential classes?

    Is this a bug on 5.2.0 or my code is implicitly broken with undetectable under 5.1.1 problems?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      John.Curious
      wrote on last edited by
      #2

      To leave this thread with an answer, it appeared that I was using Q_DECLARE_METATYPE_TEMPLATE_1ARG macro, which came quite handy to me, but that macro is not documented in QT and they changed its behavior, starting from 5.2.0.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved