我无法弄清楚为什么我不能返回我的函数。有任何想法吗?
我得到的错误是;'*' 标记和 ')' 标记之前的预期主表达式。
(不确定这是 C++ 还是 Qt 错误,我不是这两个方面的专家)
int MainWindow::createPacket(const QString &source)
{
QGraphicsView *editor = new QGraphicsView;
int tabIndex = packet->addTab(editor, source);
packet->setCurrentIndex(tabIndex);
return paintEvent(QPaintEvent*); <<<<<<<<< The line the error appears on.
}
void MainWindow::paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::black);
QRect rect = QRect(10, 20, 70, 40);
painter.drawText(rect, Qt::AlignCenter,
"Source");
painter.drawRect(rect);
}