add 'search class' to "gui.lisp"; small revesions;
This commit is contained in:
parent
f04f2e3181
commit
089cd59b35
5 changed files with 71 additions and 10 deletions
|
|
@ -9,9 +9,11 @@
|
|||
<div style="width: 600px; margin: 20px;">
|
||||
<h2>Slime REPL Hook</h2>
|
||||
<p>
|
||||
<hr>
|
||||
<p><b>Please note:</b></p>
|
||||
<p>You need to enable this mode manually by uncommenting this line in <code>eql-start-swank.lisp</code> in your Slime directory:
|
||||
<br> <code>(setf eql:*slime-mode* :repl-hook)</code></p>
|
||||
<br><br> <code>(setf eql:*slime-mode* :repl-hook)</code></p>
|
||||
<hr>
|
||||
<p>Requires <b>ECL threads</b>.</p>
|
||||
<p>This should work with any Slime version that plays together with ECL.
|
||||
<br>Tested with ECL 12.7.1 (Windows: ECL 12.12.1)</p>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ A list of features:
|
|||
a simple example:
|
||||
|
||||
document.getElementById("x") // JavaScript
|
||||
(! "findFirstElement" (frame) "#x") ; Lisp
|
||||
(|findFirstElement| (frame) "#x") ; Lisp
|
||||
|
||||
(passing QWebElements between JavaScript and Lisp is just native)
|
||||
|
||||
|
|
@ -29,5 +29,9 @@ A list of features:
|
|||
see QLOAD-C++)
|
||||
|
||||
|
||||
See directory "Tic-Tac-Toe/" for an example of a WebKit application.
|
||||
"Html Utils"
|
||||
============
|
||||
|
||||
See directory "Tic-Tac-Toe/" for an example of a plain WebKit application,
|
||||
using only some simple convenience utility functions, defined in
|
||||
"Tic-Tac-Toe/h-utils.lisp".
|
||||
|
|
|
|||
|
|
@ -390,9 +390,7 @@
|
|||
(element (ensure-web-element web-element)))
|
||||
(assert (string= "IMG" (tag-name element)) nil
|
||||
"Wanted <img>, got <~(~A~)>." (tag-name element))
|
||||
;; HACK: we call the same JS function using 2 different names (see your Qt version)
|
||||
(js "Lisp.pixmap().assignTo(this)" element) ; new name (latest Qt 4.8)
|
||||
(js "Lisp.pixmap().assignToHTMLImageElement(this)" element))) ; original name (earlier versions)
|
||||
(js "Lisp.pixmap().assignToHTMLImageElement(this)" element)))
|
||||
|
||||
(defun to-pixmap (web-element &optional scale-factor)
|
||||
"Render web element into a pixmap, optionally scaling it."
|
||||
|
|
|
|||
19
gui/gui.lisp
19
gui/gui.lisp
|
|
@ -46,6 +46,7 @@
|
|||
*q-slots*
|
||||
*q-super-classes*
|
||||
*qt-tab*
|
||||
*search-class*
|
||||
*search-help*
|
||||
*select*
|
||||
*selected-widget*
|
||||
|
|
@ -75,10 +76,14 @@
|
|||
(set-tree *primitives* 2 (tr "Qt/C++ type") (tr "Lisp example / type"))
|
||||
;; please see example 9: editor.lisp for better completer examples
|
||||
(let ((cpl (qnew "QCompleter")))
|
||||
(dolist (w (list *display* *edit* *package-name* *selected-widget* (! "popup" cpl)))
|
||||
(dolist (w (list *display* *edit* *package-name* *selected-widget* *search-class* (! "popup" cpl)))
|
||||
(qset w "font" *code-font*))
|
||||
(! "setModel" cpl *completer-list*)
|
||||
(! "setCompleter" *edit* cpl))
|
||||
(let ((cpl (qnew "QCompleter(QStringList)" (qobject-names))))
|
||||
(! "setCompletionMode" cpl |QCompleter.InlineCompletion|)
|
||||
(! "setCaseSensitivity" cpl |Qt.CaseInsensitive|)
|
||||
(! "setCompleter" *search-class* cpl))
|
||||
(! "addItems" *q-names* (qobject-names :q))
|
||||
(! "addItems" *n-names* (qobject-names :n))
|
||||
(qconnect *q-super-classes* "linkActivated(QString)" 'change-class-q-object)
|
||||
|
|
@ -88,6 +93,7 @@
|
|||
(qconnect *edit* "returnPressed()" 'eval-edit)
|
||||
(qconnect *select* "clicked()" (lambda () (qselect 'widget-selected)))
|
||||
(qconnect *properties* "clicked()" 'show-properties-dialog)
|
||||
(qconnect *search-class* "returnPressed()" 'select-class)
|
||||
(qconnect *search-help* "textChanged(QString)" 'search-help)
|
||||
(qconnect *search-help* "returnPressed()" 'search-help)
|
||||
(qoverride *edit* "keyPressEvent(QKeyEvent*)" 'history-move)
|
||||
|
|
@ -166,6 +172,17 @@
|
|||
(set-listen t)
|
||||
(! "setOverrideCursor" "QGuiApplication" cross-cursor)))
|
||||
|
||||
(defun select-class ()
|
||||
(flet ((set-tab-index (i)
|
||||
(! "setCurrentIndex" *qt-tab* i)))
|
||||
(let ((name (! "text" *search-class*)))
|
||||
(cond ((find name (qobject-names :q) :test 'string=)
|
||||
(set-tab-index 0)
|
||||
(change-class-q-object name :super))
|
||||
((find name (qobject-names :n) :test 'string=)
|
||||
(set-tab-index 1)
|
||||
(change-class-n-object name :super))))))
|
||||
|
||||
(defun change-class-q-object (s &optional super)
|
||||
(let ((i (! "findText" *q-names* s)))
|
||||
(if (= -1 i)
|
||||
|
|
|
|||
46
gui/gui.ui
46
gui/gui.ui
|
|
@ -78,11 +78,38 @@
|
|||
<attribute name="title">
|
||||
<string>Qt</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search_class">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type class name and hit Return</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="qt_tab">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
|
@ -322,10 +349,23 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search_help"/>
|
||||
<widget class="QLineEdit" name="search_help">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hit Return to find next</string>
|
||||
</property>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue