No such signal
创建了工具栏,添加了第三个QAction时,在MainWindow类里
RectAction[2] = new QAction(tr("&Text"), this);
RectAction[2]->setStatusTip(tr("Inpute a Text."));
RectAction[2]->setIcon(QIcon("icons/encoding.png"));
connect(RectAction[2],SIGNAL(triggered()),this,SLOT(Text_selected()));
m_ptoolbar->addAction(RectAction[2]);/////
m_paction = RectAction[2];////m_paction 为全局变量,为了传到另一个类里
void MainWindow::Text_selected()
{
emit createText();//信号能进这里,发到另一个类里面
}
另一个类
MyPainter::MyPainter()//MyPainter里面做信号处理
{
connect(m_paction,SIGNAL(createText()),this,SLOT(recvtocreateText()),Qt::DirectConnection);//这里连接createText信号!!!
}
void MyPainter::recvtocreateText()///这个槽函数不被执行!!!!!
{
QLineEdit *edit = new QLineEdit(this);
edit->move(QPoint());//
edit->show();
}