Roson讲Qt#17 谈谈Qt QML、Qt Quick、Qt Quick Controls之间的关系

野性酷女 2022-09-10 02:25 79阅读 0赞

目录

1.概念

2.关系和区别

3.扩展

3.1QML语言提供的基本数据类型

3.2QML语言提供的基本对象类型

3.3Qt Quick的子模块

3.4Qt Quick提供的基本数据类型

3.5Qt Quick提供的基本对象类型


1.概念

Qt QML:QML是一种用户界面规范和编程语言。它允许开发人员和设计师一样创建高性能、流畅的动画和视觉上吸引人的应用程序。QML提供了高可读性、声明性、类似json的语法,支持命令式JavaScript表达式和动态属性绑定。QML语言和引擎基础结构由Qt QML模块提供。

Qt Quick**模块:**Qt Quick是QML的类型和功能的标准库。它包括视觉类型,交互类型,动画,模型和视图,粒子效果和着色效果。QML应用程序开发人员可以通过一个导入语句访问所有这些功能。QtQuick QML库由QtQuick模块提供。

Qt Quick Controls模块:提供了一组控件,可用于在Qt Quick中构建完整的接口。

2.关系和区别

QML是一种编程语言,和C++,C#,Java一样,属于一种编程语言。QML提供一些基本的数据类型。

Qt Quick是一个库,作用和我们说的C++标准库一样,如果要编写C++代码,肯定需要C++标准库的支撑。我们在写Qt Quick应用程序时,肯定需要用到一些数据类型,还有一些语法,而这些东西,就是Qt Quick提供的。在QML已经提供的基础数据类型的基础上,Qt Quick又引入了更高级易用的数据类型,这就好比QML中有char*,Qt Quick又搞了个CString。

Qt Quick Controls是Qt Quick的一个子模块,Qt Quick不仅包含Controls,还包含了
Dialogs、Layouts等模块。

3.扩展

3.1QML语言提供的基本数据类型




















date Date value
point Value with x and y attributes
rect Value with x, y, width and height attributes
size Value with width and height attributes

3.2QML语言提供的基本对象类型




















































Date Provides date functions
Number Object provides represents a number value
String Object represents a string value
Component Encapsulates a QML component definition
Qt Provides a global object with useful enums and functions from Qt
QtObject A basic QML type
Locale Provides locale specific properties and formatted data
LoggingCategory Defines a logging category in QML
Binding Enables the arbitrary creation of property bindings
Connections Describes generalized connections to signals
Instantiator Dynamically creates objects
Timer Triggers a handler at a specified interval

3.3Qt Quick的子模块

Qt Quick包含几个子模块,并且这些子模块还包含额外的类型。子模块列举如下:

  • XML List Model - contains types for creating models from XML data
  • Local Storage - a submodule containing a JavaScript interface for an SQLite database
  • Particles - provides a particle system for QML applications
  • Window - contains types for creating top-level windows and accessing screen information
  • Dialogs - contains types for creating and interacting with system dialogs
  • Controls - provides a set of reusable UI components
  • Layouts - contains types that are used to arrange items in the user interface
  • Tests - types for testing QML applications.

3.4Qt Quick提供的基本数据类型
































color ARGB color value. The color type refers to an ARGB color value. It can be specified in a number of ways:
font Font value with the properties of QFont. The font type refers to a font value with the properties of QFont
matrix4x4 A matrix4x4 type is a 4-row and 4-column matrix
quaternion A quaternion type has scalar, x, y, and z attributes
vector2d A vector2d type has x and y attributes
vector3d Value with x, y, and z attributes
vector4d A vector4d type has x, y, z and w attributes

3.5Qt Quick提供的基本对象类型

QtQuick导入提供的所有对象类型都基于Item类型,该类型本身派生自QtObject。在导入QtQuick时,Qt QML模块提供的QML对象类型(如QtObject和Component)也可用。
































































































































































































































































































































































































































































Canvas Provides a 2D canvas item enabling drawing via JavaScript
CanvasGradient Provides an opaque CanvasGradient interface
CanvasImageData Contains image pixel data in RGBA order
CanvasPixelArray Provides ordered and indexed access to the components of each pixel in image data
Context2D Provides 2D context for shapes on a Canvas item
Accessible Enables accessibility of QML items
AnimatedImage Plays animations stored as a series of images
AnimatedSprite Draws a sprite animation
BorderImage Paints a border based on an image
Drag For specifying drag and drop events for moved Items
DragEvent Provides information about a drag event
DropArea For specifying drag and drop handling in an area
KeyEvent Provides information about a key event
MouseEvent Provides information about a mouse event
WheelEvent Provides information about a mouse wheel event
Flickable Provides a surface that can be “flicked”
Flipable Provides a surface that can be flipped
FocusScope Explicitly creates a focus scope
GraphicsInfo Provides information about the used Qt Quick backend
GridView For specifying a grid view of items provided by a model
Image Displays an image
EnterKey Provides a property to manipulate the appearance of Enter key on an on-screen keyboard
Item A basic visual QML type
KeyNavigation Supports key navigation by arrow keys
Keys Provides key handling to Items
LayoutMirroring Property used to mirror layout behavior
Transform For specifying advanced transformations on Items
AnchorAnimation Animates changes in anchor values
ParentAnimation Animates changes in parent values
PathAnimation Animates an item along a path
ItemGrabResult Contains the results from a call to Item::grabToImage()
ViewTransition Specifies items under transition in a view
ListView Provides a list view of items provided by a model
Loader Allows dynamic loading of a subtree from a URL or Component
MouseArea Enables simple mouse handling
GestureEvent Parameter given with the gestureStarted signal
MultiPointTouchArea Enables handling of multiple touch points
TouchPoint Describes a touch point in a MultiPointTouchArea
PathView Lays out model-provided items on a path
PinchArea Enables simple pinch gesture handling
PinchEvent For specifying information about a pinch event
Column Positions its children in a column
Flow Positions its children side by side, wrapping as necessary
Grid Positions its children in grid formation
Positioner Provides attached properties that contain details on where an item exists in a positioner
Row Positions its children in a row
Gradient Defines a gradient fill
GradientStop Defines the color at a position in a Gradient
Rectangle Paints a filled rectangle with an optional border
Repeater Instantiates a number of Item-based components using a provided model
ShaderEffect Applies custom shaders to a rectangle
BorderImageMesh Defines a mesh with vertices arranged like those of a BorderImage
GridMesh Defines a mesh with vertices arranged in a grid
ShaderEffectSource Renders a Qt Quick item into a texture and displays it
Sprite Specifies sprite animations
SpriteSequence Draws a sprite animation
AnchorChanges Specifies how to change the anchors of an item in a state
ParentChange Specifies how to reparent an Item in a state change
Text Specifies how to add formatted text to a scene
TextEdit Displays multiple lines of editable formatted text
TextInput Displays an editable line of text
Matrix4x4 Provides a way to apply a 4x4 tranformation matrix to an Item
Rotation Provides a way to rotate an Item
Scale Provides a way to scale an Item
Translate Provides a way to move an Item without changing its x or y properties
Animation Is the base of all QML animations
ColorAnimation Animates changes in color values
NumberAnimation Animates changes in qreal-type values
ParallelAnimation Enables animations to be run in parallel
PauseAnimation Provides a pause for an animation
PropertyAction Specifies immediate property changes during animation
PropertyAnimation Animates changes in property values
RotationAnimation Animates changes in rotation values
ScriptAction Defines scripts to be run during an animation
SequentialAnimation Allows animations to be run sequentially
Vector3dAnimation Animates changes in QVector3d values
AnimationController Enables manual control of animations
Animator Is the base of all QML animators
OpacityAnimator Type animates the opacity of an Item
RotationAnimator Type animates the rotation of an Item
ScaleAnimator Type animates the scale factor of an Item
UniformAnimator Type animates a uniform of a ShaderEffect
XAnimator Type animates the x position of an Item
YAnimator Type animates the y position of an Item
Behavior Defines a default animation for a property change
FontLoader Allows fonts to be loaded by name or URL
FontMetrics Provides metrics for a given font
Path Defines a path for use by PathView
PathArc Defines an arc with the given radius
PathAttribute Specifies how to set an attribute at a given position in a Path
PathCubic Defines a cubic Bezier curve with two control points
PathCurve Defines a point on a Catmull-Rom curve
PathElement The base path type
PathLine Defines a straight line
PathPercent Manipulates the way a path is interpreted
PathQuad Defines a quadratic Bezier curve with a control point
PathSvg Defines a path using an SVG path data string
PathInterpolator Specifies how to manually animate along a path
PropertyChanges Describes new property bindings or values for a state
Shortcut Provides keyboard shortcuts
SmoothedAnimation Allows a property to smoothly track a value
SpringAnimation Allows a property to track a value in a spring-like motion
State Defines configurations of objects and properties
StateChangeScript Specifies how to run a script in a state
StateGroup Provides built-in state support for non-Item types
SystemPalette Provides access to the Qt palettes
TextMetrics Provides metrics for a given font and text
Transition Defines animated transitions that occur on state changes
DoubleValidator Defines a validator for non-integer numbers
IntValidator Defines a validator for integer values
RegExpValidator Provides a string validator

发表评论

表情:
评论列表 (有 0 条评论,79人围观)

还没有评论,来说两句吧...

相关阅读