-
Notifications
You must be signed in to change notification settings - Fork 7
QML PoC6 API
QML API
The QML API is similar to the PoC 6 Javascript API. All methods can be shared across both implementations. Please note that this page will list methods which haven't been adopted by the Javascript API yet and should be considered proposed.
The QML API has one magic object eth. The eth object exposes method and variables from the ethereum browser to the QML interface.
-
block ( number_or_hash ): Retrieves a block in the canonical chain by the givennumberorhash.-1may be given to get the latest block. -
eachStorageAt ( address, callback ): Iterates over the storage of the given object'saddressyieldingcallbackfor each key / pair. -
key ( ): Returns the current key object. AKeyobject consist out of the following fields:-
address: address associated with this key. -
privateKey: the private key that belongs to this key pair.
-
The API also adds a helper function not directly related to the state of ethereum or it's block chain.
-
fromNumber ( hex ): Casts the given value passed byhexto a Big integer and returns it as string.
var filter = eth.watch({latest: -1, to: "cc6b22b87c8d1b607c92f4870f70e20658112f96"});
filter.changed(function(messages) {
console.log(messages);
});Qml files loaded as a plugin within ethereal will be added as a tab to the sidebar. Qml files can customise the sidebar:
iconSourcetitlemenuItem.secondaryTitle
Note: When a QML file it's loaded it expects an iconSource and title and therefor must be specified. If you don't include them your QML file will fail to load.
When your QML file is loaded it will call the onLoad function if it's present and onDestroy when your application is closed.
import QtQuick 2.0
Rectangle {
id: root
property var title: "Your title"
property var iconSoruce: "path/to/icon.png"
property var menuItem
function onReady() {
// Set the secondary title (3.)
menuItem.secondaryTitle = "Hello world";
}
Text {
x: parent.width / 2
y: parent.height / 2
text: "Hello world"
}
}