Qt之预编译宏用法
传统包含头文件的方式
1)直接包含头文件形式;
2)类前申明方式;
预编译宏的形式
主要看下预编译宏方式的用法:
例如,
//test.h
QT_BEGIN_NAMESPACE
class QPushButton;
class QLineEdit;
QT_END_NAMESPACE;
//charts
QT_CHARTS_START_NAMESPACE
class QChartView;
class QChart;
QT_CHARTS_END_NAMESPACE
//test.cpp
#include <QChartView>
#include <QChart>
#include <QPushButton>
#include <QLineEdit>
... ...