Created
February 5, 2011 07:12
-
-
Save kurohuku/812289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; CommonQtの関数を再定義する。 | |
;;; CommonQtはquicklisp経由で入れた commonqt-20110110-git | |
;;; Qtのバージョンは4.7.1 | |
;;; (#_property obj prop-name) 時、prop-nameに大文字が入っていると | |
;;; 何故か""が返るので、string-downcaseを追加した。 | |
;;; #_property で返る値がqobjectクラスでない場合があるので、 | |
;;; typecaseを追加して、#_propertyの戻り値がqobjectの時だけ | |
;;; #_toStringや#_toIntを呼び出すようにした。 | |
(in-package :qt) | |
(defun property (object property) | |
(multiple-value-bind (name property) | |
(etypecase property | |
(qobject (values (#_name property) property)) | |
(string (values property (or (find property | |
(object-properties object) | |
:key (lambda (x) (#_name x)) | |
:test #'equal) | |
(error "no such property ~A on ~A" | |
property object))))) | |
(let ((variant (#_property object (string-downcase name)))) | |
(if variant | |
(typecase variant | |
(qobject | |
(values (funcall (variant-reader (#_typeName property)) variant) t)) | |
(T (values variant t))) | |
(values nil nil))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment