4.Qt Core

本文深入介绍了QtCore模块,它是Qt框架的基础部分,涵盖了核心的数据类型、对象模型、输入输出类、多线程编程等内容,并详细解释了动画框架、状态机、JSON支持等高级特性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Qt Core提供的框架:

1、动画框架
2、在Qt JSON支持
3、状态机框架
4、如何创建Qt插件
5、事件系统

2. QtCore模块是所有其它Qt模块的基础,包含以下核心功能:

  • Qt Data Types:数据类型
  • Qt Object Model:对象模型(包括元对象模型、属性系统、信号与槽机制、对象树)
  • Input/Output Classes:I/O读写
  • Threading and Concurrent Programming:多线程和并发编程
  • QCoreApplication:应用程序类
  • Event System :事件系统
  • Container Classes:容器类
  • Animation Framework:动画框架
  • Qt Plugins:插件类
  • State Machine Framework:状态机
  • JSON Support:JSON读写
  • Qt Resource System: 资源系统
  • Implicit Sharing:隐性共享

在这里插入图片描述

Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. qt.core.plugin.factoryloader: checking directory path "/opt/Qt/5.15.2/gcc_64/plugins/platforms" ... qt.core.plugin.factoryloader: looking at "libqeglfs.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqlinuxfb.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqminimal.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqminimalegl.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqoffscreen.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqvnc.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqxcb.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqeglfs.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqeglfs.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "eglfs" ] }, "archlevel": 0, "className": "QEglFSIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqeglfs.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqeglfs.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqlinuxfb.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqlinuxfb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "linuxfb" ] }, "archlevel": 0, "className": "QLinuxFbIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqlinuxfb.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqlinuxfb.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqminimal.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqminimal.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "archlevel": 0, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqminimal.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqminimal.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqminimalegl.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqminimalegl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimalegl" ] }, "archlevel": 0, "className": "QMinimalEglIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqminimalegl.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqminimalegl.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqoffscreen.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqoffscreen.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "archlevel": 0, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqoffscreen.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqoffscreen.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqvnc.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqvnc.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vnc" ] }, "archlevel": 0, "className": "QVncIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqvnc.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqvnc.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqxcb.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "xcb" ] }, "archlevel": 0, "className": "QXcbIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-egl.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-generic.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-xcomposite-egl.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-xcomposite-glx.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqwebgl.so.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-egl.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-egl" ] }, "archlevel": 0, "className": "QWaylandEglPlatformIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-egl.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-egl.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-generic.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-generic.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland" ] }, "archlevel": 0, "className": "QWaylandIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-generic.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-generic.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-xcomposite-egl.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-xcomposite-egl" ] }, "archlevel": 0, "className": "QWaylandXCompositeEglPlatformIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqwayland-xcomposite-glx.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-xcomposite-glx" ] }, "archlevel": 0, "className": "QWaylandXCompositeGlxPlatformIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: looking at "libqwebgl.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwebgl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "webgl" ] }, "archlevel": 0, "className": "QWebGLIntegrationPlugin", "debug": false, "version": 331520 } qt.core.plugin.loader: In /opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwebgl.so: Plugin uses incompatible Qt library (5.15.0) [release] qt.core.plugin.factoryloader: "The plugin '/opt/Qt/5.15.2/gcc_64/plugins/platforms/libqwebgl.so' uses incompatible Qt library. (5.15.0) [release]" not a plugin qt.core.plugin.factoryloader: checking directory path "/opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms" ... qt.core.plugin.factoryloader: looking at "libqeglfs.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqeglfs.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "eglfs" ] }, "archlevel": 1, "className": "QEglFSIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("eglfs") qt.core.plugin.factoryloader: looking at "libqlinuxfb.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqlinuxfb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "linuxfb" ] }, "archlevel": 1, "className": "QLinuxFbIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("linuxfb") qt.core.plugin.factoryloader: looking at "libqminimal.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimal.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "archlevel": 1, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal") qt.core.plugin.factoryloader: looking at "libqminimalegl.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimalegl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimalegl" ] }, "archlevel": 1, "className": "QMinimalEglIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimalegl") qt.core.plugin.factoryloader: looking at "libqoffscreen.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqoffscreen.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "archlevel": 1, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen") qt.core.plugin.factoryloader: looking at "libqvkkhrdisplay.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqvkkhrdisplay.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vkkhrdisplay" ] }, "archlevel": 1, "className": "QVkKhrDisplayIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vkkhrdisplay") qt.core.plugin.factoryloader: looking at "libqvnc.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqvnc.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vnc" ] }, "archlevel": 1, "className": "QVncIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vnc") qt.core.plugin.factoryloader: looking at "libqwayland-egl.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqwayland-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-egl" ] }, "archlevel": 1, "className": "QWaylandEglPlatformIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl") qt.core.plugin.factoryloader: looking at "libqwayland-generic.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqwayland-generic.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland" ] }, "archlevel": 1, "className": "QWaylandIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland") qt.core.plugin.factoryloader: looking at "libqxcb.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "xcb" ] }, "archlevel": 1, "className": "QXcbIntegrationPlugin", "debug": false, "version": 395520 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("xcb") qt.core.plugin.factoryloader: checking directory path "/opt/Qt/Tools/QtCreator/bin/platforms" ... qt.core.library: "/opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" cannot load: Cannot load library /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: libxcb-cursor.so.0: 无法打开共享对象文件: 没有那个文件或目录 qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: libxcb-cursor.so.0: 无法打开共享对象文件: 没有那个文件或目录" qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, wayland-egl, wayland, xcb. 已放弃 (核心已转储)
最新发布
08-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

thefist11

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值