https://github.com/jemc/qml-sockets
Exposing Qt's C++ socket objects to QML for declarative use.
https://github.com/jemc/qml-sockets
Last synced: 8 months ago
JSON representation
Exposing Qt's C++ socket objects to QML for declarative use.
- Host: GitHub
- URL: https://github.com/jemc/qml-sockets
- Owner: jemc
- License: mit
- Created: 2014-01-07T07:57:56.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-04T15:00:20.000Z (over 9 years ago)
- Last Synced: 2025-01-28T15:15:28.872Z (10 months ago)
- Language: QML
- Homepage:
- Size: 121 KB
- Stars: 49
- Watchers: 5
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-qt-qml - qml-sockets - Exposing Qt's C++ socket objects to QML for declarative use. (Networking)
README
# QML Sockets
Exposing Qt's C++ socket objects to QML for declarative use.
## Overview
Qt [says][QmlLang]:
> QML offers a highly readable, declarative, JSON-like syntax with support for
> imperative JavaScript expressions combined with dynamic property bindings.
Qt also provides some very useful socket objects in their [QtNetwork] C++ API.
However, Qt does not provide these objects in a QML API. This plugin is an
attempt do so in order to simplify socket programming for basic applications.
The QML API provided may not be able to handle some of the more advanced use
cases, but the lowered ceremony it brings to socket programming can get you
from idea to implementation in just a few lines:
```qml
import Sockets 1.0
TCPSocket {
host: "www.the-world.com"
port: 1025
Component.onCompleted: connect()
onConnected: write("Hello, World!")
onRead: console.log("The World says:", message)
onDisconnected: console.log("Goodbye, Cruel World...")
}
```
[QmlLang]: http://qt-project.org/doc/qt-5/qmlapplications.html
[QtNetwork]: http://qt-project.org/doc/qt-5/qtnetwork-programming.html