• Qt class加载头文件


    Qt 加载头文件的方式最好用class类型。

    一、现象

    在widget.h头文件中进行添加Qt库中的头文件时,每次用#include 形式,自动补全都不友好。
    在combowidgetmapper案例中,看到其中的头文件引用是通过 class xxx; 此时自动补全很友好。
    另外,查阅资料可知,class确实比#include好,建议都用class进行引用qt库文件。

    源码

    QT_BEGIN_NAMESPACE
    class QComboBox;
    class QDataWidgetMapper;
    class QLabel;
    class QLineEdit;
    class QPushButton;
    class QStandardItemModel;
    class QStringListModel;
    class QTextEdit;
    QT_END_NAMESPACE
    
    作者:yusq77

    -------------------------------------------

    Wish you all the best and good health in 2021.

  • 相关阅读:
    两种方法生成随机字符串
    cmd命令总结
    NOI前乱写
    多校模拟9
    字符串 口胡
    HEOI2020游记
    省选模拟104
    省选模拟103
    省选模拟102
    省选模拟101
  • 原文地址:https://www.cnblogs.com/yusq77/p/13745952.html
Copyright © 2020-2023  润新知