QOperatingSystemVersionclass provides information about the operating system version. 更多 …
New in version 5.9.
def
majorVersion
()
def
microVersion
()
def
minorVersion
()
def
name
()
def
segmentCount
()
def
type
()
def
current
()
def
currentType
()
不像其它版本函数在
QSysInfo,QOperatingSystemVersionprovides access to the full version number thatdeveloperstypically use to vary behavior or determine whether to enable APIs or features based on the operating system version (as opposed to the kernel version number or marketing version).This class is also a complete replacement for
macVersionandwindowsVersion, additionally providing access to the third (micro) version number component.Presently, Android, Apple Platforms (iOS, macOS, tvOS, and watchOS), and Windows are supported.
majorVersion(),minorVersion(),和microVersion()functions return the parts of the operating system version number based on:
平台
值
Android
result of parsing android.os.Build.VERSION.RELEASE 使用
QVersionNumber, with a fallback to android.os.Build.VERSION.SDK_INT to determine the major and minor version component if the former failsApple Platforms
majorVersion,minorVersion, and patchVersion from NSProcessInfo.operatingSystemVersionWindows
dwMajorVersion, dwMinorVersion, and dwBuildNumber from RtlGetVersion - note that this function ALWAYS return the version number of the underlying operating system, as opposed to the shim underneath GetVersionEx that hides the real version number if the application is not manifested for that version of the OS
因为
QOperatingSystemVersionstores both a version number and an OS type, the OS type can be taken into account when performing comparisons. For example, on a macOS system running macOS Sierra (v10.12), the following expression will returnfalseeven though the major version number component of the object on the left hand side of the expression (10) is greater than that of the object on the right (9):QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 9)This allows expressions for multiple operating systems to be joined with a logical OR operator and still work as expected. For example:
auto current = QOperatingSystemVersion::current(); if (current >= QOperatingSystemVersion::OSXYosemite || current >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) { // returns true on macOS >= 10.10 and iOS >= 8.0, but false on macOS < 10.10 and iOS < 8.0 }A more naive comparison algorithm might incorrectly return true on all versions of macOS, including Mac OS 9. This behavior is achieved by overloading the comparison operators to return
falsewhenever the OS types of theQOperatingSystemVersioninstances being compared do not match. Be aware that due to this it can be the casex>= y andx< y are BOTHfalsefor the same instances ofxandy.
QOperatingSystemVersion
(
osType
,
vmajor
[
,
vminor=-1
[
,
vmicro=-1
]
]
)
¶
QOperatingSystemVersion(QOperatingSystemVersion)
- param osType
OSType- param vminor
int- param QOperatingSystemVersion
- param vmicro
int- param vmajor
int
构造
QOperatingSystemVersion
consisting of the OS type
osType
, and major, minor, and micro version numbers
vmajor
,
vminor
and
vmicro
,分别。
PySide2.QtCore.QOperatingSystemVersion.
OSType
¶
This enum provides symbolic names for the various operating system families supported by
QOperatingSystemVersion
.
|
常量 |
描述 |
|---|---|
|
QOperatingSystemVersion.Android |
The Google Android operating system. |
|
QOperatingSystemVersion.IOS |
The Apple iOS operating system. |
|
QOperatingSystemVersion.MacOS |
The Apple macOS operating system. |
|
QOperatingSystemVersion.TvOS |
The Apple tvOS operating system. |
|
QOperatingSystemVersion.WatchOS |
The Apple watchOS operating system. |
|
QOperatingSystemVersion.Windows |
The Microsoft Windows operating system. |
|
QOperatingSystemVersion.Unknown |
An unknown or unsupported operating system. |
PySide2.QtCore.QOperatingSystemVersion.
Windows7
¶
PySide2.QtCore.QOperatingSystemVersion.
Windows8
¶
PySide2.QtCore.QOperatingSystemVersion.
Windows8_1
¶
PySide2.QtCore.QOperatingSystemVersion.
Windows10
¶
PySide2.QtCore.QOperatingSystemVersion.
OSXMavericks
¶
PySide2.QtCore.QOperatingSystemVersion.
OSXYosemite
¶
PySide2.QtCore.QOperatingSystemVersion.
OSXElCapitan
¶
PySide2.QtCore.QOperatingSystemVersion.
MacOSSierra
¶
PySide2.QtCore.QOperatingSystemVersion.
MacOSHighSierra
¶
PySide2.QtCore.QOperatingSystemVersion.
MacOSMojave
¶
PySide2.QtCore.QOperatingSystemVersion.
MacOSCatalina
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidJellyBean
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidJellyBean_MR1
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidJellyBean_MR2
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidKitKat
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidLollipop
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidLollipop_MR1
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidMarshmallow
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidNougat
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidNougat_MR1
¶
PySide2.QtCore.QOperatingSystemVersion.
AndroidOreo
¶
PySide2.QtCore.QOperatingSystemVersion.
current
(
)
¶
返回
QOperatingSystemVersion
指示当前 OS (操作系统) 及其版本号。
另请参阅
PySide2.QtCore.QOperatingSystemVersion.
currentType
(
)
¶
返回当前 OS 类型无需构造
QOperatingSystemVersion
实例。
另请参阅
PySide2.QtCore.QOperatingSystemVersion.
majorVersion
(
)
¶
int
Returns the major version number, that is, the first segment of the operating system’s version number.
See the main class documentation for what the major version number is on a given operating system.
-1 indicates an unknown or absent version number component.
PySide2.QtCore.QOperatingSystemVersion.
microVersion
(
)
¶
int
Returns the micro version number, that is, the third segment of the operating system’s version number.
See the main class documentation for what the micro version number is on a given operating system.
-1 indicates an unknown or absent version number component.
PySide2.QtCore.QOperatingSystemVersion.
minorVersion
(
)
¶
int
Returns the minor version number, that is, the second segment of the operating system’s version number.
See the main class documentation for what the minor version number is on a given operating system.
-1 indicates an unknown or absent version number component.
PySide2.QtCore.QOperatingSystemVersion.
name
(
)
¶
unicode
Returns a string representation of the OS type identified by the
QOperatingSystemVersion
.
另请参阅
PySide2.QtCore.QOperatingSystemVersion.
segmentCount
(
)
¶
int
Returns the number of integers stored in the version number.
PySide2.QtCore.QOperatingSystemVersion.
type
(
)
¶
Returns the OS type identified by the
QOperatingSystemVersion
.
另请参阅