1

这是.h文件:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>

class MainWindow : public QMainWindow
{
public:
    MainWindow();

private:
};

#endif // MAINWINDOW_H

使用 .h 文件,我得到错误:

expected class-name before '{' token in Qt

我可以添加#include <QMainWindow>并且错误消失了,但我不明白为什么。应该QtGui包括QMainWindow?

4

1 回答 1

0

The QtGui doesn't include QMainWindow anymore because the widgets are in a different module, in Qt5.

The file listing "includes" for the widgets is QtWidgets/QtWidgets.

于 2013-03-18T08:51:20.643 回答