尝试连接信号,以便在主窗口类中验证登录时,将信号继承到派生形状类中,以在
QEventLoop
中画一条线。然而,连接函数给出了一个错误:
没有匹配的函数来调用“connect”。
// Function for line paint event
void Line::paintEvent(QPaintEvent *event)
{
QPainter *myline = new QPainter(this);
//QPainter myline(this);
QPen linePen(Qt::green);
linePen.setWidth(10);
myline->setPen(linePen);
QEventLoop loop;
connect(myline, SIGNAL(shapeValue()), &loop, SLOT(quit()), Qt::QueuedConnection);
loop.exec();
QLineF line(10.0, 80.0, 90.0, 20.0);
myline->drawLine(50, 50, 200, 200);
show();
}
我认为您可能使用了错误的名为“shapeValue()”的信号函数。 我对Qt有足够的经验。如果你给我你的项目的 Github url,我会全力支持你。 Skype:直播:.cid.ac72af6b84483869 祝你好运!