# Function List

##

    LQML

    clipboard-text ()

      Calls QGuiApplication::clipboard()->text().

    copy-all-asset-files ()

      Mobile only. Preamble: all asset files are automatically copied to the app
      directory on the very first app startup.

      If you eventually need to copy additional asset files, or replace the current
      ones, use this function (after installing an app update).

    define-qt-wrappers (qt-library &rest what)

      Defines Lisp methods for all Qt methods/signals/slots of given library,
      previously loaded with QLOAD-C++.

        (define-qt-wrappers *c++*)          ; generate wrappers
        (define-qt-wrappers *c++* :methods) ; Qt methods only (no slots/signals)
        (my-qt-function *c++* x y)          ; call from Lisp

    ensure-permissions (&rest permissions)

      Android only; requests the passed permissions. Returns the list of
      granted permissions. If the permission name starts with
      'android.permission.', a Lisp symbol of the name only can be passed,
      otherwise the full identifier must be passed.

        (ensure-permissions :access-fine-location)
        (ensure-permissions "com.android.alarm.permission.SET_ALARM")

    find-quick-item (object-name)

      Finds the first QQuickItem matching OBJECT-NAME.
      See also WITH-ROOT-ITEM if you want to find items inside a specific item,
      like in a QML Repeater.

    hex (integer)

      Used internally, you should never need to call this explicitly.
      Since we only have floats in QML/JS, INTEGERs from Lisp are converted
      automatically to hex strings, if (1) populating an item model, or (2) passed
      with function QJS.

      Those hex strings are automatically converted back to a Lisp INTEGER when
      passed with 'Lisp.call()' or 'Lisp.apply()'.

      Important note: because of the automatic conversion of INTEGERs, you need to
      explicitly add '(float x)' in Lisp to values you don't want to be converted
      to hex strings, like drawing a line in a QML Canvas, or a FIXNUM integer
      which you want as number type in JS.

    mobile-p ()

      On mobile returns one of :ANDROID, :IOS, :SFOS.

    pixel-ratio ()

      Returns the effective device pixel ratio.

    q! (method-name item/name &rest arguments)

      For calling methods of QML items.

        (q! |requestPaint| *canvas*)

    q< (property-name item/name)

      Convenience macro for QML-GET. Use symbol instead of string name.

        (q< |text| *label*)
        (q< |font.pixelSize| *label*)

    q> (property-name item/name value)

      Convenience macro for QML-SET. Use symbol instead of string name.

        (q> |text| *label* "greetings!")

    q>* (property-name item/name value)

      Convenience macro for QML-SET-ALL. Use symbol instead of string name. Sets
      given property of all items sharing the same 'objectName'.

    qapropos (string &optional qt-object/name)

      Searches properties, methods, signals, slots for STRING in QObject (e.g.
      QQuickItem) passed as second argument. A QQuickItem can also be passed by
      its 'objectName'.

        (qapropos nil *canvas*)
        (qapropos "color")

    qapropos* (name &optional qt-object/name)

      Similar to QAPROPOS, returning the results as nested list.

    qchildren (item/name)

      Like QML function children().

    qcopy-file (from to)

      Convenience function for android, for e.g. copying files from 'assets:/',
      which can't be accessed directly from Lisp.

        (qcopy-file "assets:/lib/asdf.fas" "asdf.fas")

    qdirectory (path)

      Convenience function for android, which works also with 'assets:/'
      paths.

        (qdirectory "assets:/lib")

    qeql (qt-object-1 qt-object-2)

      Returns T if passed QT-OBJECTs are pointer equal.

    qescape (string)

      Calls QString::toHtmlEscaped().

    qexec (&optional milliseconds)

      Calls QCoreApplication::exec(). Optionally pass the time in milliseconds
      after which QEventLoop::exit() will be called. See also QSLEEP.

    qexit ()

      Calls QEventLoop::exit(), in order to exit event processing after a call
      to QEXEC with a timeout. Returns T if the event loop has effectively been
      exited.

    qfind-child (qt-object name)

      Calls QObject::findChild<QObject*>().

    qfrom-utf8 (byte-array)

      Returns the BYTE-ARRAY (vector of octets) converted using
      QString::fromUtf8().

    qget (qt-object name)

      Gets a Qt property. Enumerator values are returned as integer values.
      Returns T as second return value for successful calls.

        (qget *quick-view* |width|)

    qjs (function item/name &rest arguments)

      Fast and convenient way to call JS functions defined in QML. You may pass
      up to 10 arguments of the following types:
      T, NIL, INTEGER, FLOAT, STRING, VECTOR of octets, ... and (nested) lists of
      mentioned arguments.

      For the complete list of supported types see 'marshal.cpp:toQVariant()'.
      A special use case is to populate an item model in QML (using a trivial JS
      glue code function) which expects a JS dictionary, see example below.

      N.B: Does not work with JS default arguments.

        (qjs |drawLine| *canvas* (float x1) (float y1) (float x2) (float y2))
        (qjs |addPlanet| *planets* (list :name "Jupiter" :src "img/jupiter.png"))

    qlater (function)

      Calls FUNCTION as soon as the Qt event loop is idle.

    qlater-sequence (&rest forms)

      Example: (qlater-sequence (foo) (bar)) expands to:

        (qlater (lambda ()
                  (foo)
                  (qlater (lambda ()
                            (bar)))))

    qload-c++ (library-name &optional unload)

      Loads a custom Qt/C++ plugin (see 'cpp-lib' in sources). The LIBRARY-NAME
      has to be passed as path to the plugin, without file ending. This offers
      a simple way to extend your application with your own Qt/C++ functions.
      The plugin will be reloaded (if supported by the OS) every time you call
      this function. If the UNLOAD argument is not NIL, the plugin will be
      unloaded (if supported by the OS).

      N.B: This works only for Qt functions with the following signature:
      "QVariant foo(QVariant, ...)" ; max 10 QVariant arguments
      Since a QVariant can also be of type QVariantList, this is a perfect fit
      for (nested) Lisp lists.

        (defparameter *c++* (qload-c++ "my-lib"))
        (qapropos nil *c++*)                      ; documentation
        (define-qt-wrappers *c++*)                ; Lisp wrapper functions

    qload-rc (file)

      Loads a Lisp file added to the Qt resource system, see *.qrc files.

        (qload-rc "lisp/example.lisp")

    qlog (arg1 &rest args)

      For debug messages. On android they can be captured with 'adb logcat'.

        (qlog 12)
        (qlog "width" w "height" h)
        (qlog "x ~A y ~A" x y)

    qnull (qt-object)

      Only useful if used with UNLESS, in order to check for a valid pointer.
      Returns T if the argument is not of type QT-OBJECT.

        (unless (qnull ui:*item*)
          ...)

    qobject-name (qt-object)

      Returns the QObject::objectName() of passed QT-OBJECT.

    qprocess-events (&optional exclude-user-input)

      Calls QCoreApplication::processEvents(). Pass T to exclude user input
      events during event processing.

    qquit (&optional (exit-status 0) (kill-all-threads t))
    qq

      Terminates LQML. Use this function instead of ECL (ext:quit) to quit
      gracefully. Negative values for EXIT-STATUS will call C abort() instead of
      normal program exit.

    qset (qt-object name1 value1 &optional name2 value2...)

      Sets a Qt property. Enumerators have to be passed as integer values.
      Returns T as second return value for successful calls.

        (qset *quick-view* |x| 100 |y| 100)

    qsingle-shot (milliseconds function)

      A single shot timer similar to QTimer::singleShot().

        (qsingle-shot 1000 'one-second-later)

    qsleep (seconds)

      Similar to SLEEP, but continuing to process Qt events.

    qto-utf8 (string)

      Returns the STRING converted to a vector of octets using
      QString::toUtf8(). Use this function instead of CL BABEL to correctly
      convert a QString (you got from Qt).

    qversion ()

      Returns the LQML version number as 'year.month.counter'. The second
      return value is the Qt version as returned by QLibraryInfo::version().

    reload ()

      Reloads all QML files, clearing the cache.

    root-item ()

      Returns the root item of the QQuickView.

    set-clipboard-text (text)

      Calls QGuiApplication::clipboard()->setText().

    tr (source &optional context plural-number)

      Macro expanding to QTRANSLATE, which calls QCoreApplication::translate().
      Both SOURCE and CONTEXT can be Lisp forms evaluating to constant strings
      (at compile time). The CONTEXT argument defaults to the Lisp file name.
      For the PLURAL-NUMBER, see Qt Assistant.

    view-status-changed (status)

      Redefine this function if you want to be notified on status changes of
      QQuickView, e.g. after a RELOAD.

        (defun qml:view-status-changed (status)
          (when (= 1 status)
            (populate-item-model)))

    with-root-item (root-item)

      Say you have a Repeater QML item with multiple instances of the same
      QQuickItem. The children of those QQuickItems all have the same object names,
      respectively. In order to access those child items, we need to search in one
      specific item of the Repeater.

        (with-root-item (q! |itemAt| ui:*repeater* 0)
          (q< |text| ui:*edit*))