qml-old/qml.wiki

190 lines
6.7 KiB
Plaintext

[[tags: egg]]
[[toc:]]
== qml
A Chicken wrapper for DOtherSide
=== Module: (qml core)
A library to simplify usage of QML user interfaces from Chicken.
== Enums
=== Usage
When a method requires an enum value, it can be handed to it using the enum's procedure plus the enum value keyword. Example:
<enscript>
(qt-connection-type auto:)
</enscript>
<procedure>(qevent-loop-process-event-flag val)</procedure>
QEventLoopProcessEventFlag flags. Available values: process-all-events:, exclude-user-input-events:, process-exclude-socket-notifiers:, and process-all-events-wait-for-more-events:.
<procedure>(qt-connection-type val)</procedure>
QConnectionType flags. Available values: auto:, direct:, queued:, blocking:, and unique:.
<procedure>(qquick-view-resize-mode val)</procedure>
QQuickViewResizeMode flags. Available values: side-view-to-root-object:, and size-root-object-to-view:.
<procedure>(qitem-data-role val)</procedure>
QItemDataRole flags. Available values: display:, decoration:, edit:, tool-tip:, status-tip:, whats-this:, font:, text-alignment:, background:, foreground:, check-state:, accessible-text:, accessible-description:, size-hint:, and initial-sort-order:.
<procedure>(qt-orientation val)</procedure>
QOrientation flags. Available values: horizontal:, and vertical:.
== Helpers
<procedure>(application-dir-path) → the application dir path</procedure>
<procedure>(process-events (flag <QEventLoopProcessEventFlag>))</procedure>
Runs the QML event processing once until all queued events are processed.
<procedure>(process-events-timed (flag <QEventLoopProcessEventFlag>) (timed <integer>))</procedure>
Runs the QML event processing until all queued events are processed or the timeout has run out.
<procedure>(gui-application-create)</procedure>
Initializes the QGuiApplication.
<procedure>(gui-application-exec)</procedure>
Executes the QGuiApplication. WARNING: This will block the Chicken process!
<procedure>(gui-application-quit)</procedure>
Quits the QGuiApplication.
<procedure>(gui-application-delete)</procedure>
Deletes the QGuiApplication.
<procedure>(qapplication-create)</procedure>
Initializes the QApplication.
<procedure>(qapplication-exec)</procedure>
Executes the QApplication. WARNING: This will block the Chicken process!
<procedure>(qapplication-quit)</procedure>
Quits the QApplication.
<procedure>(qapplication-delete)</procedure>
Deletes the QApplication.
<procedure>(qquickstyle-set-style style)</procedure>
Sets the QQuickStyle, see https://doc.qt.io/qt-5/qquickstyle.html#setStyle for details.
<procedure>(qquickstyle-set-fallback-style style)</procedure>
Sets the fallback style with QQuickStyle, see https://doc.qt.io/qt-5/qquickstyle.html#setFallbackStyle for details.
== Classes
=== <QMLBase>
A base class you can't directly use yourself, but it provides facilities like a refcounter to delete the companion pointer once it is not needed anymore.
=== <QVariant>
This class is used to pass and return value types to and from Qt, and offers a decent range of possible types.
<procedure>(new-QVariant) → <QVariant></procedure>
Creates a blank QVariant with no content.
<procedure>(qvariant (val <integer>)) → <QVariant></procedure>
Creates a QVariant with an integer.
; val : The integer to store
<procedure>(qvariant (val <boolean>)) → <QVariant></procedure>
Creates a QVariant with a boolean.
; val : The boolean to store
<procedure>(qvariant (val <string>)) → <QVariant></procedure>
Creates a QVariant with a string.
; val : The string to store
<procedure>(qvariant (val <QObject>)) → <QVariant></procedure>
Creates a QVariant with a QObject.
; val : The QObject to store
<procedure>(qvariant (val <flonum>)) → <QVariant></procedure>
Creates a QVariant with a float.
; val : The float to store
<procedure>(set (qv <QVariant>) (val <integer>)) → void</procedure>
Sets the QVariant value to the specified integer.
; qv : The QVariant to modify
; val : The integer to store
<procedure>(set (qv <QVariant>) (val <boolean>)) → void</procedure>
Sets the QVariant value to the specified boolean.
; qv : The QVariant to modify
; val : The booleant o store
<procedure>(set (qv <QVariant>) (val <flonum>)) → void</procedure>
Sets the QVariant value to the specified float.
; qv : The QVariant to modify
; val : The float to store
<procedure>(set (qv <QVariant>) (val <string>)) → void</procedure>
Sets the QVariant value to the specified string.
; qv : The QVariant to modify
; val : The string to store
<procedure>(set (qv <QVariant>) (val <QObject>)) → void</procedure>
Sets the QVariant value to the specified QObject.
; qv : The QVariant to modify
; val : The QObject to store
<procedure>(to (qv <QVariant>) (target <keyword>)) → target format</procedure>
Extracts the QVariant's value.
; qv : The QVariant to read
; target : The target format; available are integer:, boolean:, string:, flonum:, and qobject:
<procedure>(is-null? (qv <QVariant>)) → boolean</procedure>
Checks if the QVariant's value is null.
; qv : The QVariant to check
=== Author
Daniel Ziltener
=== Version History
; 0.1 : First public alpha release for users to break :)
=== License
LGPLv3
Copyright (c) 2022 Daniel Ziltener
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the disclaimer
below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.