简体   繁体   English

如何在 QT 中使用 c++ 获取系统配置

[英]How can I get the system configuration with c++ in QT

我想要系统配置,如 cpu 或显卡型号。

QSysInfo was meant for this purpose. QSysInfo就是为此目的而设计的。

For example, you can get the CPU architecture using currentCpuArchitecture .例如,您可以使用currentCpuArchitecture获取 CPU 架构。

Qt uses OpenGL for the rendering, so there is no need for specific API in there as you can use the standard OpenGL API for that: Qt 使用 OpenGL 进行渲染,因此不需要特定的 API,因为您可以使用标准的 OpenGL API:

glGetString(GL_VENDOR);
glGetString(GL_RENDERER);

For network information, you can use QNetworkInformation .对于网络信息,您可以使用QNetworkInformation

For store information, you can use QStorageInfo .对于商店信息,您可以使用QStorageInfo

For serial port information (I actually developed this one), you can use QSerialPortInfo .对于串口信息(我实际上开发了这个),您可以使用QSerialPortInfo

For printer information, you can use QPrinterInfo .对于打印机信息,您可以使用QPrinterInfo

For bluetooth information, you can use QBluetoothDeviceInfo .对于蓝牙信息,您可以使用QBluetoothDeviceInfo

For can bus device information, you can use QCanBusDeviceInfo .对于 CAN 总线设备信息,您可以使用QCanBusDeviceInfo

A good hint is to search for "info" classes in all Qt classes .一个很好的提示是在所有 Qt 类中搜索“信息”类

Qt has consistently named the classes so during its development. Qt 在其开发过程中一直如此命名这些类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在C / C ++中获取系统语言? - How can I get the system language in C/C++? 如何获取system()命令Qt C ++的输出? - How to get the output of system() command qt c++? C++/Qt:如何检测主机名或 IP 地址何时引用当前系统? - C++ / Qt: How can I detect when a hostname or IP address refers to the current system? Qt / C ++ - 如何存储配置数据 - Qt / C++ - how to store configuration data Qt C ++ | 单击QListWidget中的项目时,如何获取链接到索引的字符串数据? - Qt C++ | how can I get the string data that is linked to the index when I click an item in a QListWidget? 如何从C ++ / Qt调用Objective-C代码(特别是Mac系统库中的代码)? - How can I call Objective-C code (specifically code from Mac system libraries) from C++/Qt? 如何获得通过终端编译的 C++ 代码以使用 Qt IDE 进行编译? - How can I get C++ code that compiles via terminal to compile using the Qt IDE? 如何在 C++ 或 Qt 中获取所有货币符号和货币缩写的数组? - How can I get an array of all currency symbols and currency abbreviations in C++ or Qt? 如何使用 Qt/C++ 小部件(不是 QML)从 Android 相机获取图像 - How can I get an image from Android camera using Qt/C++ Widgets (Not QML) C ++,Qt - 如何摆脱dll依赖? - C++, Qt - How do I get rid of dll dependencies?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM