mirror of
https://gitlab.com/eql/EQL5.git
synced 2026-02-01 13:22:10 -08:00
fix QSELECT/QSEL to work with QQmlApplicationEngine created windows
This commit is contained in:
parent
f4550494ae
commit
e28e2a4af3
3 changed files with 39 additions and 19 deletions
14
examples/M-modules/quick/table-view/properties.lisp
Normal file
14
examples/M-modules/quick/table-view/properties.lisp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
;;; properties dialog
|
||||
|
||||
(defun %sym (name package)
|
||||
(find-symbol (symbol-name name) package))
|
||||
|
||||
(defun show-properties-dialog (&optional item)
|
||||
"Lists all instance properties of a QML item (either a QQuickItem or an 'objectName'). If no item is passed, QML:*CALLER* will be used."
|
||||
(unless (find-package :properties)
|
||||
(load (in-home "gui/properties")))
|
||||
(funcall (%sym :show :properties)
|
||||
(or (if (stringp item)
|
||||
(qml:find-quick-item item)
|
||||
item)
|
||||
qml:*caller*)))
|
||||
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
(qrequire :quick)
|
||||
|
||||
(require :qml-lisp "qml-lisp")
|
||||
(require :qml-lisp "qml-lisp")
|
||||
(require :properties "properties")
|
||||
|
||||
(defpackage :table-view
|
||||
(:nicknames :table)
|
||||
|
|
@ -56,7 +57,7 @@
|
|||
(|setFilterCaseSensitivity| *sort-filter-model* |Qt.CaseInsensitive|)
|
||||
(|setSourceModel| *sort-filter-model* *book-model*)
|
||||
;; view
|
||||
(setf qml:*quick-view* (qnew "QQmlApplicationEngine"))
|
||||
(setf qml:*quick-view* (qnew "QQmlApplicationEngine")) ; because of QML ApplicationWindow
|
||||
(|setContextProperty| (|rootContext| qml:*quick-view*) "sortFilterModel" *sort-filter-model*)
|
||||
(|load| qml:*quick-view* "qml/table-view.qml"))
|
||||
|
||||
|
|
|
|||
|
|
@ -31,22 +31,25 @@
|
|||
|
||||
(let ((cross-cursor (qnew "QCursor(Qt::CursorShape)" |Qt.CrossCursor|)))
|
||||
(defun object-selected (object event)
|
||||
(unless (zerop (qt-object-id object)) ; exclude unknown to EQL
|
||||
(when *listen*
|
||||
(setf *listen* nil
|
||||
*q* object
|
||||
*qml-stack* nil
|
||||
*pos* (! "pos" event))
|
||||
(setf (qt-object-unique object)
|
||||
(! ("toUInt" ("property" "EQL.unique") *q*)))
|
||||
(if (find (! "className" (! "metaObject" *q*))
|
||||
'("LQuickView" "LQuickWidget") :test 'string=)
|
||||
(indicate*) ; QML items
|
||||
(indicate)) ; QWidgets
|
||||
(! "restoreOverrideCursor" "QGuiApplication")
|
||||
(when *on-selected*
|
||||
(funcall *on-selected* object))
|
||||
t))) ; event filter
|
||||
(when (zerop (qt-object-id object)) ; unknown to EQL, so resort to QObject
|
||||
(setf (qt-object-id object) #.(qid "QObject")))
|
||||
(let ((qml (or (! "inherits" object "QQuickWidget")
|
||||
(! "inherits" object "QQuickWindow"))))
|
||||
(when (or qml (! "isWidgetType" object))
|
||||
(when *listen*
|
||||
(setf *listen* nil
|
||||
*q* (qt-object-? object)
|
||||
*qml-stack* nil
|
||||
*pos* (! "pos" event))
|
||||
(setf (qt-object-unique object)
|
||||
(! ("toUInt" ("property" "EQL.unique") *q*)))
|
||||
(if qml
|
||||
(indicate*)
|
||||
(indicate))
|
||||
(! "restoreOverrideCursor" "QGuiApplication")
|
||||
(when *on-selected*
|
||||
(funcall *on-selected* object))
|
||||
t)))) ; event filter
|
||||
(defun select-mode ()
|
||||
(setf *listen* t)
|
||||
(! "setOverrideCursor" "QGuiApplication" cross-cursor)))
|
||||
|
|
@ -129,7 +132,9 @@
|
|||
(child child*)))))
|
||||
|
||||
(defun indicate* ()
|
||||
(let ((root (! "rootObject" *q*)))
|
||||
(let ((root (if (= (qt-object-id *q*) #.(qid "QQuickWindow"))
|
||||
(! "contentItem"*q*)
|
||||
(! "rootObject" *q*))))
|
||||
(indicate-start* *q* (child root))))
|
||||
|
||||
(defun indicate-start* (parent child)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue