Class: QML::ImageProvider
- Inherits:
-
Object
- Object
- QML::ImageProvider
- Defined in:
- lib/qml/image_provider.rb
Overview
ImageProvider is used to provide images manually to QML.
QML requests images to ImageProviders when you use “image:” URL scheme (like “image://my_image_provider/foo.png”) in source specification of Image elements.
Defined Under Namespace
Instance Attribute Summary collapse
-
#qt_image_provider ⇒ Object
readonly
Returns the value of attribute qt_image_provider.
Instance Method Summary collapse
-
#initialize ⇒ ImageProvider
constructor
A new instance of ImageProvider.
-
#request(req) ⇒ Object
abstract
Implement this method to handle image requests from QML.
Constructor Details
#initialize ⇒ ImageProvider
Returns a new instance of ImageProvider.
53 54 55 56 57 |
# File 'lib/qml/image_provider.rb', line 53 def initialize @callback = Callback.new(self) @qt_image_provider = Plugins.core.createImageProvider(@callback) @qt_image_provider.prefer_managed false end |
Instance Attribute Details
#qt_image_provider ⇒ Object (readonly)
Returns the value of attribute qt_image_provider.
51 52 53 |
# File 'lib/qml/image_provider.rb', line 51 def qt_image_provider @qt_image_provider end |
Instance Method Details
#request(req) ⇒ Object
This method is abstract.
Implement this method to handle image requests from QML.
Call QML::ImageProvider::Request#finish to finish image loading. Image loading should be done asynchnorously because this method is called within the event loop.
67 68 69 |
# File 'lib/qml/image_provider.rb', line 67 def request(req) fail ::NotImplementedError end |