Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
KC3 2013 懇談会LT 「QML + C++で楽しい!」
Search
Yuto Tokunaga
September 08, 2013
Programming
1
190
KC3 2013 懇談会LT 「QML + C++で楽しい!」
2013/9/8のKC3 2013の懇談会のLTで使ったものです
LaTeX Beamerで作りました(ドヤァ
Yuto Tokunaga
September 08, 2013
Tweet
Share
More Decks by Yuto Tokunaga
See All by Yuto Tokunaga
SyaroNote
yuntan
0
1.9k
QMLでFlappyBirdを作ろう
yuntan
0
1.5k
Haskellでbrainfckインタプリタを書きたかった話
yuntan
0
860
KC3 2014 懇親会LT 「Let It ʕ ◔π◔ʔGo」
yuntan
0
140
QMLとモバイル
yuntan
0
890
Other Decks in Programming
See All in Programming
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.3k
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
現場で役立つモデリング 超入門
masuda220
PRO
15
3.1k
Jakarta EE meets AI
ivargrimstad
0
200
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
450
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
CSC509 Lecture 12
javiergs
PRO
0
140
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.2k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
3
950
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.2k
イベント駆動で成長して委員会
happymana
1
300
DefinitelyTypedに初めてPRを出した話
syumai
0
130
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
820
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
700
Producing Creativity
orderedlist
PRO
341
39k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Happy Clients
brianwarren
97
6.7k
Music & Morning Musume
bryan
46
6.2k
Being A Developer After 40
akosma
86
590k
Docker and Python
trallard
40
3.1k
Speed Design
sergeychernyshev
24
600
Transcript
QML + C++ Ͱ ָ͍͠ʂ ಙӬ ༤ే OUCC Sep 8th
ಙӬ ༤ే QML + C++ 1/13
Qtͱ Qt ͱΫϩεϓϥοτϑΥʔϜͷΞϓϦέʔγϣϯ։ ൃϑϨʔϜϫʔΫͰ͢ɻ؆୯ʹ͍͑ Qt Ͱ࡞ͨ͠ι ϑτଟ͘ͷػثͰಈ͘ͱ͍͏͜ͱͰ͢ɻ දతͳϓϥοτϑΥʔϜͱͯ͠ Windows, Mac
OS X, Unix Linux(X Window System) ͜ΕΒΛΧόʔͯ͠ ͓Γ࣮࣭తʹύιίϯͳΒͯ͢ಈ͖·͢ɻϞόΠϧ ରԠ͍ͯ͠·͕͢ Android ͱ iOSɺWindows Phone ࢼݧతͳஈ֊Ͱਖ਼ࣜʹରԠ͢Δͷ͍ۙকདྷ Ͱ͢ɻ ຊ Qt ϢʔβʔձϗʔϜϖʔδΑΓ ಙӬ ༤ే QML + C++ 2/13
࠾༻ࣄྫ Qt VirtualBox, Google Earth, Skype, Handbreak, KDE ͳͲͳ
Ͳʹ࠾༻͞Ε͍ͯΔ ಙӬ ༤ే QML + C++ 3/13
࠾༻ࣄྫ Qt VirtualBox, Google Earth, Skype, Handbreak, KDE ͳͲͳ
Ͳʹ࠾༻͞Ε͍ͯΔ ࠷ۙͷΞϓϦʮ؋ϝϞʯ Qt Λͬͯ࡞ΒΕ͍ͯ·͢ʂ ʂ ʂ http://relog.xii.jp/mt5r/2013/08/post-349.html ಙӬ ༤ే QML + C++ 3/13
Qt Quickͱ • QML(Qt Meta-Object Language) Qt Quick Ͱ৽ͨʹಋೖ͞Εͨ,UI Λهड़͢ΔͨΊͷϓϩάϥ
ϛϯάݴޠ. એݴܕݴޠʹྨ͞ΕΔ. ϩδοΫͷهड़ʹ JavaScript ͕͑Δ. • Qt Creator IDE QML/JS ʹରԠͨ͠ IDE • QtDeclarative Ϟδϡʔϧ QML Λ࣮ߦ͢ΔͨΊͷΤϯδϯ Ҏ্ͷ 3 ͔ͭΒߏ͞ΕΔ UI ςΫϊϩδʔͷϑϨʔϜϫʔΫ. Qt Japanese Blog ΑΓ ಙӬ ༤ే QML + C++ 4/13
Qt Quickͱ • QML(Qt Meta-Object Language) Qt Quick Ͱ৽ͨʹಋೖ͞Εͨ,UI Λهड़͢ΔͨΊͷϓϩάϥ
ϛϯάݴޠ. એݴܕݴޠʹྨ͞ΕΔ. ϩδοΫͷهड़ʹ JavaScript ͕͑Δ. • Qt Creator IDE QML/JS ʹରԠͨ͠ IDE • QtDeclarative Ϟδϡʔϧ QML Λ࣮ߦ͢ΔͨΊͷΤϯδϯ Ҏ্ͷ 3 ͔ͭΒߏ͞ΕΔ UI ςΫϊϩδʔͷϑϨʔϜϫʔΫ. Qt Japanese Blog ΑΓ QML ͱ JS ΛͬͯΞϓϦΛ࡞Δ = Qt Quick ͱݺΜͰ͍͍Μ ͡Όͳ͍͔ͱ ಙӬ ༤ే QML + C++ 4/13
QMLͬͯͲΜͳݴޠʁ ެ͔ࣜΒαϯϓϧͱͯ͠ग़͍ͯΔ ͷΛհ͠·͢ ಙӬ ༤ే QML + C++ 5/13
Ͳ͜Ͱಈ͘Α ಙӬ ༤ే QML + C++ 6/13
Ͳ͜Ͱಈ͘Α ָ͍͠ʂ ʂ ಙӬ ༤ే QML + C++ 7/13
͏ͪΐ ͬͱ࣮༻తͳͷΛ Qt Λͬͯͳʹ͔࣮༻తͳͷΛ࡞Γ͍ͨͳʙ . . 1 JavaScript ΛΒͳ͍ (͓͍͍͠ͷʁ)
. . 2 QML + JS Ͱશͯͷ Qt ͷϞδϡʔϧ͕͑Δ Θ͚Ͱͳ͍ . . 3 C++Ͱॻ͔Εͨ Qt ϥΠϒϥϦͦͷ··Ͱ QML ͔Β͑ͳ͍ . . 4 ษڧதͷ C++ Λ͍͍ͨ ಙӬ ༤ే QML + C++ 8/13
͏ͪΐ ͬͱ࣮༻తͳͷΛ Qt Λͬͯͳʹ͔࣮༻తͳͷΛ࡞Γ͍ͨͳʙ . . 1 JavaScript ΛΒͳ͍ (͓͍͍͠ͷʁ)
. . 2 QML + JS Ͱશͯͷ Qt ͷϞδϡʔϧ͕͑Δ Θ͚Ͱͳ͍ . . 3 C++Ͱॻ͔Εͨ Qt ϥΠϒϥϦͦͷ··Ͱ QML ͔Β͑ͳ͍ . . 4 ษڧதͷ C++ Λ͍͍ͨ C++ Ͱ QML Module Λ࡞ͬͯͦΕΛ QML ͔Β ͏͜ͱʹ͠Α͏ʂ ಙӬ ༤ే QML + C++ 8/13
QML Moduleͱ UI ෦ػೳΛఆٛͨ͠ͷ QML ͔ΒಡΈࠐΜͰ͑Δ QML Ͱ C++ Ͱ࡞ΕΔʂ
ಙӬ ༤ే QML + C++ 9/13
QML Moduleͱ UI ෦ػೳΛఆٛͨ͠ͷ QML ͔ΒಡΈࠐΜͰ͑Δ QML Ͱ C++ Ͱ࡞ΕΔʂ
UI Λ QML Ͱ, ϩδοΫΛ C++Ͱ࣮͢Δ͜ͱ Ͱ,UI ͷίʔυͱϩδοΫͷίʔυΛ͚ΒΕΔ! ಙӬ ༤ే QML + C++ 9/13
ͦ͏ͩ,twitterΫϥΠΞϯτΛ࡞Ζ͏ OAuth ೝূͷͨΊͷϥΠϒϥϦʹ kQOAuth Λ༻ ೝূը໘, λΠϜϥΠϯͳͲ UI QML
Ͱ࣮͠,OAuth ೝ ূ,twitter ͱͷ௨৴, औಘͨ͠σʔλͷཧͳͲ C++Ͱ࣮ ࠓճ Ubuntu SDK ͍·ͨ͠ ಙӬ ༤ే QML + C++ 10/13
. . . . . . aztterhometlhelper.h 1 #include <QObject>
2 #include "aztteruserstream.h" 3 4 class AztterHomeTLHelper : public QObject 5 { 6 Q_OBJECT 7 Q_PROPERTY(QVariantMap tweet READ tweet) 8 9 public: 10 explicit AztterHomeTLHelper(QObject *parent = 0); 11 Q_INVOKABLE void startFetching(); 12 Q_INVOKABLE void streamDisconnect(); 13 QVariantMap tweet() const; 14 15 signals: 16 void tweetReceived(); 17 18 private slots: 19 void parseStream(const QByteArray&); 20 private: 21 void parseTweet(const QJsonObject&); 22 23 AztterUserStream *m_stream; 24 QVariantMap m_tweet; 25 }; Yuuto Tokunaga QML + C++
. . . . . . Timeline.qml 1 import QtQuick
2.0 2 import Ubuntu.Components 0.1 3 import Ubuntu.Components.ListItems 0.1 as ListItem 4 import "aztterplugin" 1.0 5 6 ListView { 7 id: homeTLView 8 9 Component.onCompleted: helper.startFetching() 10 11 AztterHomeTLHelper { 12 id: helper 13 onTweetReceived: listModel.prepend(tweet) 14 } 15 AztterTweetListModel { 16 id: listModel 17 } 18 model: listModel 19 delegate: TweetItem { 20 text: tweetText 21 name: userName 22 screenName: "@" + userScreenName 23 iconSource: userProfileImageUrl 24 } 25 } Yuuto Tokunaga QML + C++
͜Μͳ͔Μ͡ʹ ಙӬ ༤ే QML + C++ 11/13
͜Μͳ͔Μ͡ʹ ָ͍͠ʂ ʂ ಙӬ ༤ే QML + C++ 12/13
͍͞͝ʹ ߴʹಈ࡞͠, ͔ͭ Write once, run anywhere Λࢦ͢ Qt ಙӬ
༤ే QML + C++ 13/13
͍͞͝ʹ ߴʹಈ࡞͠, ͔ͭ Write once, run anywhere Λࢦ͢ Qt ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
ಙӬ ༤ే QML + C++ 13/13