SlideShare a Scribd company logo
超酷炫科幻 UI
QML 入門
Fred Chien
錢逢祥
超酷炫科幻 UI
你會想到什麼?
QML
Qt Modeling Language
import QtQuick 2.3
import QtQuick.Controls 1.3
ApplicationWindow {
visible: true;
width: 200;
height: 200;
}
長相如下:
http://qt.io/
5.0, 5.1, 5.2, 5.3 or 5.4+
Qt 5
Windows, Linux, Mac OS
Cross-platform
Android, iOS...
Cross-platform
就想到 C++
很多人看到 Qt
Don't Worry
別擔心
我們今天絕對不會用到
我們只會提到
QML
Qt Modeling Language
There are serval way to play QML
你有幾種方式可以跑 QML
Linux 使用者唯一的方法
直接裝 Qt
Windows & Mac 使用者
使用 OwaViewer
從例子來看
基本用法
import QtQuick 2.3
import QtQuick.Controls 1.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
}
第一個例子
import QtQuick 2.3
import QtQuick.Controls 1.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
}
第一個例子
一個 QML 檔案中
最基本的模組
import QtQuick 2.3
import QtQuick.Controls 1.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
}
第一個例子
控制相關模組
import QtQuick 2.3
import QtQuick.Controls 1.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
}
第一個例子
元件類型 {
屬性: 參數
...
}
import QtQuick 2.3
import QtQuick.Controls 1.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
}
第一個例子
視窗可顯示
視窗寬度
視窗高度
自己打造的視窗!
現在你有一個視窗了!
加入一個元件到視窗中
加入一張圖片吧
Image {
x: 50;
y: 80;
width: 200;
height: 200;
source: 'example.jpg'
}
圖片元件的基本使用
x 軸座標位置
y 軸座標位置
圖片寬度
圖片高度
圖片檔案位置
import QtQuick 2.3
import QtQuick.Controls 2.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
}
加入元件到視窗中
import QtQuick 2.3
import QtQuick.Controls 2.3
ApplicationWindow {
visible: true;
width: 800;
height: 600;
Image { ... }
}
加入元件到視窗中
Image {
x: 50;
y: 80;
width: 200;
height: 200;
source: 'example.jpg'
}
Text 元件
加入一段文字吧
Text {
x: 50;
y: 80;
font.pointSize: 20;
text: 'QML Workshop';
color: '#ffffff';
}
文字元件的基本使用
字體大小
字串內容
字體顏色
font.bold: true;
font.family: 'Arial';
font.italic: true;
font.underline: true;
font.strikeout: true;
lineHeight: true;
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignVCenter;
文字元件的更多常用屬性
Rectangle 元件
矩形色塊
Rectangle {
x: 50;
y: 80;
width: 200;
height: 200;
radius: 5;
color: 'red';
}
矩形元件的基本使用
gradient: Gradient {
GradientStop { position: 0.0; color: '#000000' }
GradientStop { position: 1.0; color: '#ffffff' }
}
矩形元件的漸層填色屬性
特異功能由此開始
元件的基本屬性
visible: true;
opacity: 0.5;
rotation: 45;
scale: 0.5;
常用基本屬性
是否可見
透明度
旋轉角度
尺寸大小
Layout
排版
anchors.left
anchors.right
anchors.top
anchors.bottom
anchors.centerIn
Anchors 常用屬性
Animation
動畫
NumberAnimation {
target: box;
running: true;
property: 'opacity';
from: 0;
to: 1;
duration: 1000;
easing.type: Easing.Linear;
}
動畫元件範例
對特定元件套用動畫
對特定屬性做變化
啟用動畫
動畫持續一秒
線性加速
數值起始點
數值終止點
ColorAnimation {
target: box;
running: true;
property: 'color';
to: 'yellow';
duration: 1000;
easing.type: Easing.Linear;
}
顏色動畫元件
對特定元件套用動畫
對特定屬性做變化
啟用動畫
動畫持續一秒
線性加速
數值終止點
SequentialAnimation {
running: true;
loops: 3;
}
有序動畫元件
循環次數
若想無限循環,可設 loops 為 Animation.Infinite
SequentialAnimation {
running: true;
NumberAnimation { ... }
NumberAnimation { ... }
NumberAnimation { ... }
NumberAnimation { ... }
}
有序動畫元件
完成後才跑下一個動畫
ParallelAnimation {
running: true;
NumberAnimation { ... }
NumberAnimation { ... }
NumberAnimation { ... }
NumberAnimation { ... }
}
平行動畫元件
全部動畫同時一起跑
更多練習
More Examples

More Related Content

What's hot

ansible why ?
ansible why ?ansible why ?
ansible why ?
Yashar Esmaildokht
 
Hypervisor seminar
Hypervisor seminarHypervisor seminar
Hypervisor seminar용환 노
 
QML 與 C++ 的美麗邂逅
QML 與 C++ 的美麗邂逅QML 與 C++ 的美麗邂逅
QML 與 C++ 的美麗邂逅
Jack Yang
 
모니터링 영역의 변천사_클라우드, 디지털 경험까지)
모니터링 영역의 변천사_클라우드, 디지털 경험까지)모니터링 영역의 변천사_클라우드, 디지털 경험까지)
모니터링 영역의 변천사_클라우드, 디지털 경험까지)
IMQA
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
Knoldus Inc.
 
The Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech Talks
The Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech TalksThe Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech Talks
The Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech Talks
Amazon Web Services
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Omid Vahdaty
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
Khizer Naeem
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
Gena Mykhailiuta
 
Jenkins for java world
Jenkins for java worldJenkins for java world
Jenkins for java world
Ashok Kumar
 
Security Testing using ZAP in SFDC
Security Testing using ZAP in SFDCSecurity Testing using ZAP in SFDC
Security Testing using ZAP in SFDC
Thinqloud
 
Configuration management with puppet
Configuration management with puppetConfiguration management with puppet
Configuration management with puppet
Jakub Stransky
 
자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020
자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020 자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020
자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020
AWSKRUG - AWS한국사용자모임
 
IBM MQ - High Availability and Disaster Recovery
IBM MQ - High Availability and Disaster RecoveryIBM MQ - High Availability and Disaster Recovery
IBM MQ - High Availability and Disaster Recovery
MarkTaylorIBM
 
Cypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfCypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdf
bacancytechnology
 
Laravel Core Concept & Ecosystem
Laravel Core Concept & EcosystemLaravel Core Concept & Ecosystem
Laravel Core Concept & Ecosystem
Mesut Vatansever
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
플레이오토 ECS 사용사례
플레이오토 ECS 사용사례플레이오토 ECS 사용사례
플레이오토 ECS 사용사례
JaeSeong Lee
 

What's hot (20)

ansible why ?
ansible why ?ansible why ?
ansible why ?
 
Hypervisor seminar
Hypervisor seminarHypervisor seminar
Hypervisor seminar
 
QML 與 C++ 的美麗邂逅
QML 與 C++ 的美麗邂逅QML 與 C++ 的美麗邂逅
QML 與 C++ 的美麗邂逅
 
모니터링 영역의 변천사_클라우드, 디지털 경험까지)
모니터링 영역의 변천사_클라우드, 디지털 경험까지)모니터링 영역의 변천사_클라우드, 디지털 경험까지)
모니터링 영역의 변천사_클라우드, 디지털 경험까지)
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
The Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech Talks
The Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech TalksThe Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech Talks
The Nitro Project: Next-Generation EC2 Infrastructure - AWS Online Tech Talks
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
Was ist Docker?
Was ist Docker?Was ist Docker?
Was ist Docker?
 
Jenkins for java world
Jenkins for java worldJenkins for java world
Jenkins for java world
 
Security Testing using ZAP in SFDC
Security Testing using ZAP in SFDCSecurity Testing using ZAP in SFDC
Security Testing using ZAP in SFDC
 
Configuration management with puppet
Configuration management with puppetConfiguration management with puppet
Configuration management with puppet
 
자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020
자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020 자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020
자바를 잡아주는 GURU가 있다구!? - 우여명 (아이스크림에듀) :: AWS Community Day 2020
 
IBM MQ - High Availability and Disaster Recovery
IBM MQ - High Availability and Disaster RecoveryIBM MQ - High Availability and Disaster Recovery
IBM MQ - High Availability and Disaster Recovery
 
Cypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfCypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdf
 
Laravel Core Concept & Ecosystem
Laravel Core Concept & EcosystemLaravel Core Concept & Ecosystem
Laravel Core Concept & Ecosystem
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
플레이오토 ECS 사용사례
플레이오토 ECS 사용사례플레이오토 ECS 사용사례
플레이오토 ECS 사용사례
 

Similar to 超酷炫科幻 UI:QML 入門

Qt gui编程
Qt gui编程Qt gui编程
Qt gui编程
hangang123
 
C++ gui qt
C++ gui qtC++ gui qt
C++ gui qtbiehege
 
LLVM introduction
LLVM introductionLLVM introduction
使用Qt+和open gl®+创建跨平台可视化ui
使用Qt+和open gl®+创建跨平台可视化ui使用Qt+和open gl®+创建跨平台可视化ui
使用Qt+和open gl®+创建跨平台可视化ui
lsdsjy
 
igdshare 110220: LuaJIT intro
igdshare 110220: LuaJIT introigdshare 110220: LuaJIT intro
igdshare 110220: LuaJIT intro
igdshare
 
用最潮的 Java script 盡情開發 kde qt 程式
用最潮的 Java script 盡情開發 kde qt 程式用最潮的 Java script 盡情開發 kde qt 程式
用最潮的 Java script 盡情開發 kde qt 程式
Fred Chien
 
全新的Qt5
全新的Qt5全新的Qt5
全新的Qt5
Yunqiao Yin
 
Python&GUI
Python&GUIPython&GUI
Python&GUI
Leo Zhou
 
QML + Arduino & Leap Motion
QML + Arduino & Leap MotionQML + Arduino & Leap Motion
QML + Arduino & Leap Motion
diro fan
 
Coscup2011: porting android to brand-new cpu architecture
Coscup2011: porting android to brand-new cpu architecture Coscup2011: porting android to brand-new cpu architecture
Coscup2011: porting android to brand-new cpu architecture lusecheng
 
IoT開發平台NodeMCU
IoT開發平台NodeMCUIoT開發平台NodeMCU
IoT開發平台NodeMCU
承翰 蔡
 
Java - TA課 - 開發環境
Java - TA課 - 開發環境Java - TA課 - 開發環境
[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例
[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例
[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例
TIM WANG
 
程式人雜誌 -- 2013年2月號
程式人雜誌 -- 2013年2月號程式人雜誌 -- 2013年2月號
程式人雜誌 -- 2013年2月號
鍾誠 陳鍾誠
 
Node.js 進攻桌面開發
Node.js 進攻桌面開發Node.js 進攻桌面開發
Node.js 進攻桌面開發
Fred Chien
 
Qt 入門就上手 !!
Qt 入門就上手 !!Qt 入門就上手 !!
Qt 入門就上手 !!
輝亮 游
 
[NTU CSIE] Intro to Windows lab
[NTU CSIE] Intro to Windows lab[NTU CSIE] Intro to Windows lab
[NTU CSIE] Intro to Windows lab
Ming-Yuan Jian
 
Linux运维趋势 第0期 运维自动化
Linux运维趋势 第0期 运维自动化Linux运维趋势 第0期 运维自动化
Linux运维趋势 第0期 运维自动化
51CTO
 
Docker 123
Docker 123Docker 123
Docker 123
WeiChih Ting
 

Similar to 超酷炫科幻 UI:QML 入門 (20)

Qt gui编程
Qt gui编程Qt gui编程
Qt gui编程
 
C++ gui qt
C++ gui qtC++ gui qt
C++ gui qt
 
LLVM introduction
LLVM introductionLLVM introduction
LLVM introduction
 
使用Qt+和open gl®+创建跨平台可视化ui
使用Qt+和open gl®+创建跨平台可视化ui使用Qt+和open gl®+创建跨平台可视化ui
使用Qt+和open gl®+创建跨平台可视化ui
 
igdshare 110220: LuaJIT intro
igdshare 110220: LuaJIT introigdshare 110220: LuaJIT intro
igdshare 110220: LuaJIT intro
 
用最潮的 Java script 盡情開發 kde qt 程式
用最潮的 Java script 盡情開發 kde qt 程式用最潮的 Java script 盡情開發 kde qt 程式
用最潮的 Java script 盡情開發 kde qt 程式
 
全新的Qt5
全新的Qt5全新的Qt5
全新的Qt5
 
Python&GUI
Python&GUIPython&GUI
Python&GUI
 
QML + Arduino & Leap Motion
QML + Arduino & Leap MotionQML + Arduino & Leap Motion
QML + Arduino & Leap Motion
 
Coscup2011: porting android to brand-new cpu architecture
Coscup2011: porting android to brand-new cpu architecture Coscup2011: porting android to brand-new cpu architecture
Coscup2011: porting android to brand-new cpu architecture
 
IoT開發平台NodeMCU
IoT開發平台NodeMCUIoT開發平台NodeMCU
IoT開發平台NodeMCU
 
Inside VCL
Inside VCLInside VCL
Inside VCL
 
Java - TA課 - 開發環境
Java - TA課 - 開發環境Java - TA課 - 開發環境
Java - TA課 - 開發環境
 
[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例
[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例
[DevOpsDays] 硬體產業的DevOps導入與實踐 - 以工控產業為例
 
程式人雜誌 -- 2013年2月號
程式人雜誌 -- 2013年2月號程式人雜誌 -- 2013年2月號
程式人雜誌 -- 2013年2月號
 
Node.js 進攻桌面開發
Node.js 進攻桌面開發Node.js 進攻桌面開發
Node.js 進攻桌面開發
 
Qt 入門就上手 !!
Qt 入門就上手 !!Qt 入門就上手 !!
Qt 入門就上手 !!
 
[NTU CSIE] Intro to Windows lab
[NTU CSIE] Intro to Windows lab[NTU CSIE] Intro to Windows lab
[NTU CSIE] Intro to Windows lab
 
Linux运维趋势 第0期 运维自动化
Linux运维趋势 第0期 运维自动化Linux运维趋势 第0期 运维自动化
Linux运维趋势 第0期 运维自动化
 
Docker 123
Docker 123Docker 123
Docker 123
 

More from Fred Chien

MakerBoard: MT7688 Emulator
MakerBoard: MT7688 EmulatorMakerBoard: MT7688 Emulator
MakerBoard: MT7688 Emulator
Fred Chien
 
Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險
Fred Chien
 
Koa 正在等一個人
Koa 正在等一個人Koa 正在等一個人
Koa 正在等一個人
Fred Chien
 
OwaNEXT
OwaNEXTOwaNEXT
OwaNEXT
Fred Chien
 
QML + Node.js
QML + Node.jsQML + Node.js
QML + Node.js
Fred Chien
 
Stem OS Proposal
Stem OS ProposalStem OS Proposal
Stem OS Proposal
Fred Chien
 
Stem is JavaScript OS
Stem is JavaScript OSStem is JavaScript OS
Stem is JavaScript OS
Fred Chien
 
我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binaryFred Chien
 
App house
App houseApp house
App house
Fred Chien
 
Java script 全面逆襲!使用 node.js 打造桌面環境!
Java script 全面逆襲!使用 node.js 打造桌面環境!Java script 全面逆襲!使用 node.js 打造桌面環境!
Java script 全面逆襲!使用 node.js 打造桌面環境!
Fred Chien
 
Enjoy Writing Modern Desktop Application in JavaScript
Enjoy Writing Modern Desktop Application in JavaScriptEnjoy Writing Modern Desktop Application in JavaScript
Enjoy Writing Modern Desktop Application in JavaScript
Fred Chien
 
軟體人甘苦談
軟體人甘苦談軟體人甘苦談
軟體人甘苦談
Fred Chien
 
Non-MVC Web Framework
Non-MVC Web FrameworkNon-MVC Web Framework
Non-MVC Web Framework
Fred Chien
 
Let s Enjoy Node.js
Let s Enjoy Node.jsLet s Enjoy Node.js
Let s Enjoy Node.js
Fred Chien
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js Module
Fred Chien
 

More from Fred Chien (15)

MakerBoard: MT7688 Emulator
MakerBoard: MT7688 EmulatorMakerBoard: MT7688 Emulator
MakerBoard: MT7688 Emulator
 
Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險
 
Koa 正在等一個人
Koa 正在等一個人Koa 正在等一個人
Koa 正在等一個人
 
OwaNEXT
OwaNEXTOwaNEXT
OwaNEXT
 
QML + Node.js
QML + Node.jsQML + Node.js
QML + Node.js
 
Stem OS Proposal
Stem OS ProposalStem OS Proposal
Stem OS Proposal
 
Stem is JavaScript OS
Stem is JavaScript OSStem is JavaScript OS
Stem is JavaScript OS
 
我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary
 
App house
App houseApp house
App house
 
Java script 全面逆襲!使用 node.js 打造桌面環境!
Java script 全面逆襲!使用 node.js 打造桌面環境!Java script 全面逆襲!使用 node.js 打造桌面環境!
Java script 全面逆襲!使用 node.js 打造桌面環境!
 
Enjoy Writing Modern Desktop Application in JavaScript
Enjoy Writing Modern Desktop Application in JavaScriptEnjoy Writing Modern Desktop Application in JavaScript
Enjoy Writing Modern Desktop Application in JavaScript
 
軟體人甘苦談
軟體人甘苦談軟體人甘苦談
軟體人甘苦談
 
Non-MVC Web Framework
Non-MVC Web FrameworkNon-MVC Web Framework
Non-MVC Web Framework
 
Let s Enjoy Node.js
Let s Enjoy Node.jsLet s Enjoy Node.js
Let s Enjoy Node.js
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js Module
 

超酷炫科幻 UI:QML 入門