当前位置: 首页 > news >正文

【QML】Qt和QML获取操作系统类型

1. Qt获取系统类型

//方法
QSysInfo::productType()//举例:
if(QSysInfo::productType() == "windows")
{qDebug() << "windows system";
}

官方说明:

[static] QString QSysInfo::productType()
Returns the product name of the operating system this application is running in. If the application is running on some sort of emulation or virtualization layer (such as WINE on a Unix system), this function will inspect the emulation / virtualization layer.
Values returned by this function are stable and will not change over time, so applications can rely on the returned value as an identifier, except that new OS types may be added over time.
Linux and Android note: this function returns "android" for Linux systems running Android userspace, notably when using the Bionic library. For all other Linux systems, regardless of C library being used, it tries to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown".
macOS note: this function returns "osx" for all macOS systems, regardless of Apple naming convention. The returned string will be updated for Qt 6. Note that this function erroneously returned "macos" for macOS 10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0.
Darwin, iOS, tvOS, and watchOS note: this function returns "ios" for iOS systems, "tvos" for tvOS systems, "watchos" for watchOS systems, and "darwin" in case the system could not be determined.
FreeBSD note: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise.
Windows note: this function "winrt" for WinRT builds, and "windows" for normal desktop builds.
For other Unix-type systems, this function usually returns "unknown".
This function was introduced in Qt 5.4.
See also QFileSelector, kernelType(), kernelVersion(), productVersion(), and prettyProductName().

在这里插入图片描述

2. QML获取系统类型

//方法
Qt.platform.os//举例
if(Qt.platform.os === "windows"){console.log("windows system")}else if(Qt.platform.os === "linux"){console.log("linux system")}

官方说明:

platform : objectThe platform object provides info about the underlying platform.
Its properties are:platform.os
This read-only property contains the name of the operating system.
Possible values are:"android" - Android"ios" - iOS"tvos" - tvOS"linux" - Linux"osx" - macOS"qnx" - QNX (since Qt 5.9.3)"unix" - Other Unix-based OS"windows" - Windows"winrt" - WinRT / UWP"wasm" - WebAssembly
platform.pluginName
This is the name of the platform set on the QGuiApplication instance as returned by QGuiApplication::platformName()This property was introduced in Qt 5.1.

在这里插入图片描述

相关文章:

【QML】Qt和QML获取操作系统类型

1. Qt获取系统类型 //方法 QSysInfo::productType()//举例&#xff1a; if(QSysInfo::productType() "windows") {qDebug() << "windows system"; }官方说明&#xff1a; [static] QString QSysInfo::productType() Returns the product name of …...

CSS 显示、定位、布局、浮动

一、CSS 显示&#xff1a; CSS display属性设置元素应如何显示&#xff1b;CSS visibility属性指定元素应可见还是隐藏。隐藏元素可以通过display属性设置为“none”&#xff0c;也可以通过visibility属性设置为“hidden”。两者的区别&#xff1a;visibility:hidden可以隐藏某…...

Java 学习笔记

文章目录 一、集合1.1 List1.1.1 ArrayList1.1.2 Vector1.1.3 LinkedList 1.2 Deque1.3 Set1.4 Map1.4.1 HashMap1.4.2 LinkedHashMap 1.5 注意事项 二、函数式接口和 Lambda 表达式三、方法引用3.1 静态方法引用3.2 实例方法引用3.2 特定类型的方法引用3.4 构造器引用 四、Str…...

项目实战:优化Servlet,把所有围绕Fruit操作的Servlet封装成一个Servlet

1、FruitServlet 这些Servlet都是围绕着Fruit进行的把所有对水果增删改查的Servlet放到一个Servlet里面&#xff0c;让tomcat实例化一个Servlet对象 package com.csdn.fruit.servlet; import com.csdn.fruit.dto.PageInfo; import com.csdn.fruit.dto.PageQueryParam; import c…...

Go语言函数参数

文章目录 Go语言函数参数1. **函数参数的定义**&#xff1a;2. **参数的数量**&#xff1a;3. **参数的数据类型**&#xff1a;4. **参数的命名**&#xff1a;5. **参数的传递**&#xff1a;6. **参数的传递方式**&#xff1a;7. **空白标识符**&#xff1a; Go语言函数参数 在…...

【遍历二叉树的非递归算法,二叉树的层次遍历】

文章目录 遍历二叉树的非递归算法二叉树的层次遍历 遍历二叉树的非递归算法 先序遍历序列建立二叉树的二叉链表 中序遍历非递归算法 二叉树中序遍历的非递归算法的关键&#xff1a;在中序遍历过某个结点的整个左子树后&#xff0c;如何找到该结点的根以及右子树。 基本思想&a…...

数模之线性规划

线性规划 优化类问题&#xff1a;有限的资源&#xff0c;最大的收益 例子: 华强去水果摊找茬&#xff0c;水果摊上共3个瓜&#xff0c;华强总共有40点体力值,每劈一个瓜能带来40点挑衅值,每挑一个瓜问“你这瓜保熟吗”能带来30点挑衅值,劈瓜消耗20点体力值&#xff0c;问话消耗…...

【C++】AVL树的4中旋转调整

文章目录 前提一、AVL树的结构定义二、AVL的插入&#xff08;重点&#xff09;1. 插入的结点在较高左子树的左侧&#xff08;右单旋&#xff09;2. 新节点插入较高右子树的右侧&#xff08;左单旋&#xff09;3.新结点插入较高右子树的左侧&#xff08;先右单旋再左单旋&#x…...

【MATLAB源码-第69期】基于matlab的LDPC码,turbo码,卷积码误码率对比,码率均为1/3,BPSK调制。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 本文章介绍了卷积码、Turbo码和LDPC码。以相同的码率仿真这三种编码&#xff0c;并对比其误码率性能 信源输出的数据符号&#xff08;二进制&#xff09;是相互独立和等概率的&#xff1b; 信道是加性白高斯噪声信道&#…...

Java获取时间戳、字符串和Date对象的相互转换、日期时间格式化、获取年月日

获取时间戳&#xff08;自1970年1月1日经历的毫秒数值&#xff09; package org.example;import java.util.Date;public class Main {public static void main(String[] args) {Date date1 new Date(1699540662210L);System.out.println(date1.getTime());Date date2 new Dat…...

用c语言实现矩阵转置

下面是在 C 语言中实现矩阵转置的示例代码&#xff1a; #include <stdio.h> #define ROWS 3 #define COLS 3 void transpose(int matrix[ROWS][COLS]) { int temp; for(int i0; i<ROWS; i) { for(int j0; j<i; j) { temp matrix[i][j]; matrix[i][j] matrix[j]…...

蓝桥杯官网练习题(移动距离)

题目描述 X 星球居民小区的楼房全是一样的&#xff0c;并且按矩阵样式排列。其楼房的编号为 1,2,3, 当排满一行时&#xff0c;从下一行相邻的楼往反方向排号。 比如&#xff1a;当小区排号宽度为 6 时&#xff0c;开始情形如下&#xff1a; 1 2 3 4 5 6 12 …...

不止于“初见成效”,阿斯利康要让数据流转,以 AI 带动决策智能

“阿斯利康数字化成果在进博会上引人注目&#xff0c;令我感到非常高兴。”这是阿斯利康代表的感慨。 数字化建设目标是利用先进技术来提高企业运营效率&#xff0c;降低成本。在第六届进博会的7.2 B2-01展区&#xff0c;阿斯利康不仅展示了全球领先的生物医药和医疗器械成果&a…...

nav2 调节纯追踪算法

纯追踪算法 纯追踪基础 The core idea is to find a point on the path in front of the robot and find the linear and angular velocity to help drive towards it. 核心思想是在机器人前方的路径上找到一个点&#xff0c;并找到一个合适的线速度和角速度&#xff0c;以驱…...

安装RabbitMQ

安装RabbitMQ 下载需要的两个包 # 这直接就可以安装了&#xff0c;下面 ‘上传对应的rmp包’ 操作 [rootrabbitmq-1 ~]# curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash [rootrabbitmq-1 ~]# yum install erlang-21.3.8.2…...

Spring基础(1):两个概念

最近看了点Spring的源码&#xff0c;于是来稍微扯一扯&#xff0c;希望能帮一部分培训班出身的朋友撕开一道口子&#xff0c;透透气。 广义上的Spring指的是Spring整个项目&#xff0c;包含SpringBoot、SpringCloud、SpringFramework、SpringData等等&#xff0c; 本系列文章…...

国产化精密划片机已得到国内更多厂家青睐

国产化精密划片机在近年来得到了国内许多厂家的青睐&#xff0c;这是因为精密划片机在工业生产中有着重要作用。这种设备主要用于高精密切割加工&#xff0c;适用于多种材料&#xff0c;包括硅、石英、氧化铝、氧化铁等。 以精密晶圆划片机为例&#xff0c;这种设备采用了自主研…...

Voice Control for ChatGPT简单高效的与ChatGPT进行交流学习。

快捷又不失灵活性 日常生活中&#xff0c;我们与亲人朋友沟通交流一般都是喜欢语音的形式来完成的&#xff0c;毕竟相对于文字来说语音就不会显的那么的苍白无力&#xff0c;同时最大的好处就是能解放我们的双手吧&#xff0c;能更快实现两者间的对话&#xff0c;沟通便更高效…...

flutter生态一统甜夏 @Android @ios @windowse @macos @linux @Web

(愿景)G o o g l e 中 国flutter生态一统天下(IT) Web Android ios Windowse Macos Linux Google中国https://space.bilibili.com/64169458 https://pub-web.flutter-io.cn 构建 Flutter Web 应用 构建 Flutter Web 应用 - Flutter 中文文档 - Flutter 中文开发者网站 …...

计算机基础知识49

三板斧的使用(views.py) 三个方法&#xff1a;HttpResponse: 返回的是字符串render : 返回html文件redirect : 返回加载HTML页面的 def html(request):print(from html)# return HttpResponse(request) # 它返回的是字符串return render(request,html.html) # 返回html# ret…...

第五篇:Go 并发模型全解析——Channel、Goroutine

第五篇:Go 并发模型全解析——Channel、Goroutine 一、序章:Java 的并发往事 在 Java 世界中,说到“并发”,你可能立马想到以下名词:Thread、Runnable、ExecutorService、synchronized、volatile。再复杂点,ReentrantLock、CountDownLatch、BlockingQueue 纷纷登场,仿…...

移除元素-JavaScript【算法学习day.04】

题目链接&#xff1a;27. 移除元素 - 力扣&#xff08;LeetCode&#xff09; 第一种思路 标签&#xff1a;拷贝覆盖 主要思路是遍历数组 nums&#xff0c;每次取出的数字变量为 num&#xff0c;同时设置一个下标 ans 在遍历过程中如果出现数字与需要移除的值不相同时&#xff…...

GOOUUU ESP32-S3-CAM 果云科技开发板开发指南(一)(超详细!)Vscode+espidf 通过摄像头拍摄照片并存取到SD卡中,文末附源码

看到最近好玩的开源项目比较多&#xff0c;就想要学习一下esp32的开发&#xff0c;目前使用比较多的ide基本上是arduino、esp-idf和platformio&#xff0c;前者编译比较慢&#xff0c;后两者看到开源大佬的项目做的比较多&#xff0c;所以主要学习后两者。 本次使用的硬件是GO…...

算法练习-回溯

今天开始新的章节&#xff0c;关于算法中回溯法的练习&#xff0c;这部分题目的难度还是比较大的&#xff0c;但是十分锻炼人的思维与思考能力。 处理这类题目首先要注意几个基本点&#xff1a; 1.关于递归出口的设置&#xff0c;这是十分关键的&#xff0c;要避免死循环的产…...

RT-Thread内核组成——内核移植

内核移植就是指将 RT-Thread 内核在不同的芯片架构、不同的板卡上运行起来&#xff0c;能够具备线程管理和调度&#xff0c;内存管理&#xff0c;线程间同步和通信、定时器管理等功能。移植可分为 CPU 架构移植和 BSP&#xff08;Board support package&#xff0c;板级支持包&…...

使用 Docker Compose 从零部署 TeamCity + PostgreSQL(详细新手教程)

JetBrains TeamCity 是一款专业的持续集成&#xff08;CI&#xff09;服务器工具&#xff0c;支持各种编程语言和构建流程。本文将一步一步带你用 Docker 和 Docker Compose 快速部署 TeamCity&#xff0c;搭配 PostgreSQL 数据库&#xff0c;并确保 所有操作新手可跟着做。 一…...

Android 蓝牙通信

Android 平台提供了完整的蓝牙 API&#xff0c;支持 传统蓝牙(Bluetooth Classic)和低功耗蓝牙(BBluetooth Low Energy, BLE)两种通信方式。 以下是开发蓝牙应用的关键知识点。 1. 基本概念 传统蓝牙(Bluetooth Classic) 适合大流量数据传输(如音频、文件传输) 典型协议: R…...

【Linux】为 Git 设置 Commit 提交模板方法,可统一个人或者项目的提交风格

为 Git 设置 Commit 提交模板 新建模板文件。注意之后不能删除该文件。 gedit ~/.gitmessage.txt粘贴自己的模板。可以给 AI 提自己的需求&#xff0c;定制一个模板&#xff0c;例如 # <type>(<scope>): <description> # # [optional body] # # [optional…...

Vue.js教学第十八章:Vue 与后端交互(二):Axios 拦截器与高级应用

Vue 与后端交互(二):Axios 拦截器与高级应用 在上一篇文章中,我们学习了 Axios 的基本用法,包括如何发送不同类型的 HTTP 请求以及基本的配置选项。本文将深入剖析 Axios 的拦截器功能,探讨请求拦截器和响应拦截器的作用、配置方法和应用场景,通过实例展示如何利用拦截…...

电子电路基础2(杂乱)

电容器 容抗 滤波电路&#xff08;半波&#xff09; 全波整流 因为A点的电压比D点的电压高&#xff0c;所以D点会走向C点 电感基础 什么是电感器&#xff1f; 一种把电能转换成磁能&#xff0c;并可以将磁能存储起来的元器件。 在嵌入式开发中&#xff0c;电感主要用于动态能量…...