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. Qt5 signals and slots, "too many initializers" error

Qt5 signals and slots, "too many initializers" error

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Latexi95
    wrote on last edited by
    #1

    I'm porting my program to Qt5 but signals and slots stopped working. I have signals
    @void error(int code, QString msg, int line, QFile file);
    void warning(int code, QString msg, int line, QFile file);@
    and I'm trying to connect them to ErrorHandler class which has identical slots.
    If I use the Qt4-style-connect like
    @errHandler.connect(&codeGenerator, SIGNAL(error(int,QString,int,QFile
    )), SLOT(error(int,QString,int,QFile
    )));
    errHandler.connect(&codeGenerator, SIGNAL(warning(int,QString,int,QFile*)), SLOT(warning(int,QString,int,QFile*)));@
    I don't get any warnings or errors. They just dont work. Emiting error signal in CodeGenerator doesn't cause calling of the error slot in ErrorHandler.
    If I use the way of Qt5 to connect signals
    @QObject::connect(&codeGenerator, &CodeGenerator::error, &errHandler, &ErrorHandler::error);
    QObject::connect(&codeGenerator, &CodeGenerator::warning, &errHandler, &ErrorHandler::warning);@
    I get "too many initializers" error:
    @D:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore/qobject_impl.h(82) : error C2078: too many initializers
    D:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore/qobject_impl.h(81) : while compiling class template member function 'const int *QtPrivate::ConnectionTypes<ArgList>::types(void)'
    with
    [
    ArgList=QtPrivate::List<int,QtPrivate::List<QString,QtPrivate::List<int,QtPrivate::List<QFile *,void>>>>
    ]
    d:\qt\qt5.0.0\5.0.0\msvc2010\include\qtcore\qobject.h(245) : see reference to class template instantiation 'QtPrivate::ConnectionTypes<ArgList>' being compiled
    with
    [
    ArgList=QtPrivate::List<int,QtPrivate::List<QString,QtPrivate::List<int,QtPrivate::List<QFile ,void>>>>
    ]
    ..\Compiler\main.cpp(54) : see reference to function template instantiation 'QMetaObject::Connection QObject::connect<void(__thiscall CodeGenerator::
    )(int,QString,int,QFile ),void(__thiscall ErrorHandler:: )(int,QString,int,QFile *)>(const CodeGenerator *,Func1,const ErrorHandler ,Func2,Qt::ConnectionType)' being compiled
    with
    [
    Func1=void (__thiscall CodeGenerator::
    )(int,QString,int,QFile ),
    Func2=void (__thiscall ErrorHandler::
    )(int,QString,int,QFile *)
    ]@

    What did I miss?

    Thank you for your answers.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I don't see anything wrong in this code. I would suggest filing a bug report, but it would be nice to get a second voice on this beforehand.

      (Z(:^

      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