Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RubyとQML/Qt Quickで デスクトップアプリを 書けるようにした

Ryohei Ikegami
September 21, 2014

RubyとQML/Qt Quickで デスクトップアプリを 書けるようにした

RubyHiroba 2014でLTしました

Ryohei Ikegami

September 21, 2014
Tweet

More Decks by Ryohei Ikegami

Other Decks in Technology

Transcript

  1. require 'qml' ! QML.run do |app| app.load_path 'main.qml' end Ruby

    import QtQuick 2.2 import QtQuick.Controls 1.1 ! ApplicationWindow { visible: true width: 200 height: 100 title: "Hello, world!" } QML
  2. class ClickMe include QML::Access register_to_qml ! property :text, 'Click me'

    def on_clicked puts 'clicked' self.text = 'Clicked!!' end end Ruby ApplicationWindow { visible: true Button { text: clickMe.text onClicked: { clickMe.on_clicked() } } ClickMe { id: clickMe } } QML
  3. item.value # => 10 item.poyo Ruby Item { property var

    value: 10 function poyo() { console.log("poyo") } } QML
  4. item.value # => 10 item.poyo Ruby class Foo : public

    QObject { Q_OBJECT Q_PROPERTY( int value MEMBER m_value) int m_value = 10; public: Q_INVOKABLE void poyo() { qDebug() << "poyo"; } }; C++