QPixmapCache example

79 views
Skip to first unread message

Polos Ruetz

unread,
Feb 10, 2012, 7:54:16 AM2/10/12
to eql-user
Just wanted to share this with you:

For one of my toy projects, I needed a pixmap cache.
So why not use QPixmapCache?

I found this simple and straightforward solution:

(let ((pixmap (qnew "QPixmap")))
(defun pixmap-from-cache (file-name)
(if (qfun "QPixmapCache" "find" file-name pixmap)
pixmap
(let ((new-pixmap (qnew "QPixmap(QString)" file-name)))
(qfun "QPixmapCache" "insert" file-name new-pixmap)
new-pixmap))))

Paul
Reply all
Reply to author
Forward
0 new messages