首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 其他开发语言 >

QObject:connect: Cannot connect (null):finished() to QSignalMapper:地图()

2013-04-07 
QObject::connect: Cannot connect (null)::finished() to QSignalMapper::map()QListIteratorQToolButto

QObject::connect: Cannot connect (null)::finished() to QSignalMapper::map()

  QListIterator<QToolButton *> iter(numList);
    QListIterator<QPropertyAnimation *> iterAin(aniList);
    QPropertyAnimation *tempAni;
    int i = 0;
    if(iter.hasNext()){                 //mySignalIn -->> shanliang
        connect(this,SIGNAL(mySignalIn()),s_pSignalMapper,SLOT(map()));
        s_pSignalMapper->setMapping(this,i);
        i++;
    }
    while(iter.hasNext()){              //move -->> shanliang
        tempAni = iterAin.next();
        if(!tempAni)qDebug() << "NULL";
        connect(tempAni,SIGNAL(finished()),s_pSignalMapper,SLOT(map()));
        s_pSignalMapper->setMapping(tempAni,i);
        i++;
    }
    connect(iterAin.next(),SIGNAL(finished()),this,SLOT(collect()));
    connect(s_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(shanLiang(int)));


编译不报错,一运行就出错。
谁能告诉我为什么?? Qt QSignalMapper connect signal
[解决办法]
    QListIterator<QToolButton *> iter(numList);
    QListIterator<QPropertyAnimation *> iterAin(aniList);
    QToolButton *tempButton;
    int i = 0;
    if(iter.hasNext()){                 
        tempButton = iter.next();
        connect(this,SIGNAL(mySignalIn()),tempButton,SLOT(click()));
        connect(tempButton,SIGNAL(clicked()),s_pSignalMapper,SLOT(map()));
        s_pSignalMapper->setMapping(tempButton,i);
        i++;
    }
    while(iter.hasNext()){             
        tempButton = iter.next();
        connect(iterAin.next(),SIGNAL(finished()),tempButton,SLOT(click()));
        connect(tempButton,SIGNAL(clicked()),s_pSignalMapper,SLOT(map()));
        s_pSignalMapper->setMapping(tempButton,i);
        i++;
    }
    connect(iterAin.next(),SIGNAL(finished()),this,SLOT(collect()));
    connect(s_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(shanLiang(int)));

    //shanlaing --> move
    connect(this,SIGNAL(mySignalMove(int)),this,SLOT(SetAnimation(int)));




热点排行