QT6(11)2.5 Qt 使用技巧:快捷键等。3章 Qt框架功能概述、3.1 Qt类库中的模块:openGL,基础模块与附加模块。3.2 Qt全局定义:数据类型、函数、解读宏 qDebug() <<

(28)常用快捷键

在这里插入图片描述

++

在这里插入图片描述

(29)介绍 openGL :

在这里插入图片描述

(30) 基础模块与附加模块

在这里插入图片描述

++

在这里插入图片描述
++

在这里插入图片描述
++

在这里插入图片描述

++

在这里插入图片描述

(31)3.2 Qt全局定义

在这里插入图片描述

++ 数据类型

在这里插入图片描述

++ 全局函数

在这里插入图片描述

++ 这部分的详细内容,用到的时候,看看它 的帮助文档

在这里插入图片描述

++举例

在这里插入图片描述

(32)调试打印宏函数 qDebug,可见该 debug ( ) 函数是构成重载的,有参版本返回 void ,使用上类似于 printf( ) 的可变参函数,无参版本返回 QDebug 类型的对象。可见 QDebug 对象类似于 cout 对象,实现了 << 运算符

在这里插入图片描述

++ 补充 QDebug 的资料

在这里插入图片描述

++ 给出该 QDebug 类的简化版源码

class Q_CORE_EXPORT QDebug : public QIODeviceBase
{
    friend class QMessageLogger;
    friend class QDebugStateSaver;
    friend class QDebugStateSaverPrivate;
    struct Stream { // 略
    } *stream;
public:
    explicit QDebug(QIODevice *device) : stream(new Stream(device)) {}
    explicit QDebug(QString *string) : stream(new Stream(string)) {}
    explicit QDebug(QtMsgType t) : stream(new Stream(t)) {}
    ~QDebug();

    inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; }
    inline QDebug &nospace() { stream->space = false; return *this; }

    inline QDebug &operator<<(QChar t) { putUcs4(t.unicode()); return maybeSpace(); }
    inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }
    inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(unsigned short t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(char16_t t) { return *this << QChar(ushort(t)); }
    inline QDebug &operator<<(char32_t t) { putUcs4(t); return maybeSpace(); }
    inline QDebug &operator<<(signed int t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(qint64 t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(quint64 t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); }
    inline QDebug &operator<<(const char16_t *t)  { stream->ts << QStringView(t); return maybeSpace(); }
#if QT_STRINGVIEW_LEVEL < 2
    inline QDebug &operator<<(const QString & t) { putString(t.constData(), uint(t.length())); return maybeSpace(); }
#endif
    inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); }
    inline QDebug &operator<<(QUtf8StringView s) { putByteArray(reinterpret_cast<const char*>(s.data()), s.size(), ContainsBinary); return maybeSpace(); }
    inline QDebug &operator<<(QLatin1String t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); }
    inline QDebug &operator<<(const QByteArray & t) { putByteArray(t.constData(), t.size(), ContainsBinary); return maybeSpace(); }
    inline QDebug &operator<<(QByteArrayView t) { putByteArray(t.constData(), t.size(), ContainsBinary); return maybeSpace(); }
    inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); }
    inline QDebug &operator<<(std::nullptr_t) { stream->ts << "(nullptr)"; return maybeSpace(); }
    inline QDebug &operator<<(QTextStreamFunction f) {
        stream->ts << f;
        return *this;
    }

};

++ 总之,使用函数 qDebug ( ) 这种形式,要包含头文件 《QDEBUG》 才可以

在这里插入图片描述

++ 接着给出老师的全部的讲解,关于 QT 的宏

在这里插入图片描述

++以及

在这里插入图片描述

(33)

谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值