LQML


clipboard-text ()

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


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. Locally set *ROOT-ITEM* if
  you want to find items inside a specific item, like in a QML Repeater. See
  also note in sources.


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
  QEXEC with a timeout. Returns T if the event loop has effectively been
  exited.


qfind-child (qt-object name)

  Calls QObject::findChild().


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.
  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* x1 y1 x2 y2))
    (qjs |addPlanet| *planets* (list :name "Jupiter" :src "img/jupiter.png"))


qlater (function)

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


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


qlog (arg1 &rest args)

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

    (qlog 12)
    (qlog "width" 10 "height" 20)
    (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.


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)))