使用Qt5构建Qt4项目时出现编译时错误:
error: no matching function for call to 'MainWindow::connect(QPrintPreviewWidget*, const char*, MainWindow*, const char*)'
connect( dlgPrintPreview.previewWidget(), SIGNAL( paintRequested( QPrinter* ) ), this, SLOT( printConflictReport( QPrinter* ) ) );
^
...
C:\Qt\5.4\mingw491_32\include/QtCore/qobject.h:196:36: note: static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
static QMetaObject::Connection connect(const QObject *sender, const char *signal,
^
C:\Qt\5.4\mingw491_32\include/QtCore/qobject.h:196:36: note: no known conversion for argument 1 from 'QPrintPreviewWidget*' to 'const QObject*'
我在 .pro 文件中加入 printsupport 和小部件,将 QtGui 替换为 QtWidget - 没什么好帮的! 我究竟做错了什么?任何帮助表示赞赏