some revisions

This commit is contained in:
polos 2016-11-29 13:54:09 +01:00
parent 5a7b27c643
commit 7bef996a8e
5 changed files with 13 additions and 38 deletions

View file

@ -51,17 +51,9 @@
(|setWindowTitle| (tr "Grabber"))
(|resize| (list 400 300)))))
(defun render-into-pixmap ()
(let ((size (get-size)))
(when (every 'plusp size)
(set-pixmap (|grab| *gl-widget* (append '(0 0) size))))))
(defun grab-frame-buffer ()
(set-pixmap (|fromImage.QPixmap| (|grabFramebuffer| *gl-widget*))))
(defun clear-pixmap ()
(set-pixmap (qnew "QPixmap")))
(defun about ()
(|about.QMessageBox|
*me*
@ -79,11 +71,9 @@
(file-menu (|addMenu| menu-bar (tr "&File")))
(help-menu (|addMenu| menu-bar (tr "&Help"))))
;; file menu
(add-action file-menu (tr "&Render into Pixmap...") "Ctrl+R" 'render-into-pixmap)
(add-action file-menu (tr "&Grab Frame Buffer") "Ctrl+G" 'grab-frame-buffer)
(add-action file-menu (tr "&Clear Pixmap") "Ctrl+L" 'clear-pixmap)
(add-action file-menu (tr "&Grab Frame Buffer") "Ctrl+G" 'grab-frame-buffer)
(|addSeparator| file-menu)
(add-action file-menu (tr "E&xit") "Ctrl+Q" (lambda () (|close| *me*)))
(add-action file-menu (tr "E&xit") "Ctrl+Q" (lambda () (|close| *me*)))
;; help menu
(add-action help-menu (tr "&About") nil 'about)
(add-action help-menu (tr "About &Qt") nil (lambda () (|aboutQt| (qapp))))))
@ -109,28 +99,6 @@
(setf (first size) (1- width)))
(|resize| *pixmap-label* size)))
(defun get-size ()
(let ((text (|getText.QInputDialog|
*me*
(tr "Grabber")
(tr "Enter pixmap size:")
|QLineEdit.Normal|
(format nil "~{~D~^ x ~}" (|size| *gl-widget*))
nil))) ; ok
(if (qok)
(progn
(qlet ((reg-exp "QRegExp(QString)" "([0-9]+) *x *([0-9]+)"))
(flet ((cap (n)
(parse-integer (|cap| reg-exp n))))
(when (|exactMatch| reg-exp text)
(let ((width (cap 1))
(height (cap 2)))
(when (and (< 0 width 2048)
(< 0 height 2048))
(return-from get-size (list width height)))))))
(|size| *gl-widget*))
'(0 0))))
(defun start ()
(ini)
(x:do-with *me* |show| |raise|))

View file

@ -12,6 +12,7 @@
"windowTitle" "sqlite"))
(defun populate-db ()
;; dumb, just for this example; you normally want QSqlQuery
(x:do-with (|exec| *database*)
"CREATE TABLE friends ( id INT PRIMARY KEY, name VARCHAR(50), country INT )"
"CREATE TABLE countries ( id INT PRIMARY KEY, country VARCHAR(50) )")

View file

@ -110,6 +110,7 @@
(let ((enum (find #\: type)))
(when (or (and (qt-class-p type)
(not enum))
(starts-with "GL" type)
(not (or (string= "void" type)
enum
(upper-case-p (char type 0))
@ -309,7 +310,8 @@
(defun add-namespace (name class)
(unless (empty-string name)
(if (and class
(string/= "Handle" name))
(string/= "Handle" name)
(not (starts-with "GL" name)))
(let ((1st (char name 0))
(templ (position #\< name)))
(when templ
@ -1106,6 +1108,7 @@
"uchar"
"uint"
"ulong"
"GLuint"
"QByteArray"
"QChar"
"QFileInfoList"

View file

@ -21,6 +21,7 @@ static StrList _cstring_buffer_;
static const QMetaObject* staticQtMetaObject = QtMetaObject::get();
META_TYPE (T_bool_ok_pointer, bool*)
META_TYPE (T_GLuint, GLuint)
META_TYPE (T_QFileInfo, QFileInfo)
META_TYPE (T_QFileInfoList, QFileInfoList)
META_TYPE (T_QGradient, QGradient)
@ -344,7 +345,7 @@ static T toUInt(cl_object l_num) {
i = fixnnint(l_num); }
return i; }
static int toUInt(cl_object l_num) {
static uint toUInt(cl_object l_num) {
return toUInt<uint>(l_num); }
template<typename T>
@ -1198,6 +1199,7 @@ static MetaArg toMetaArg(const QByteArray& sType, cl_object l_arg) {
else if(T_QVector_QTextLength == n) p = new QVector<QTextLength>(toQTextLengthVector(l_arg));
else if(T_QVector_qreal == n) p = new QVector<qreal>(toqrealVector(l_arg));
else if(T_WId == n) p = new ulong(toUInt<ulong>(l_arg));
else if(T_GLuint == n) p = new GLuint(toUInt<GLuint>(l_arg));
// module types
else if((n >= LObjects::T_QHostAddress) &&
(n <= LObjects::T_QSslKey)) {
@ -1345,6 +1347,7 @@ cl_object to_lisp_arg(const MetaArg& arg) {
else if(T_QVector_QTextLength == n) l_ret = from_qtextlengthvector(*(QVector<QTextLength>*)p);
else if(T_QVector_qreal == n) l_ret = from_qrealvector(*(QVector<qreal>*)p);
else if(T_WId == n) l_ret = ecl_make_unsigned_integer(*(ulong*)p);
else if(T_GLuint == n) l_ret = ecl_make_unsigned_integer(*(GLuint*)p);
// module types
else if((n >= LObjects::T_QHostAddress) &&
(n <= LObjects::T_QSslKey)) {

View file

@ -3528,7 +3528,7 @@ class EQL_EXPORT Q122 : public Q216 { // QOpenGLWidget
public:
Q_INVOKABLE void* C(uint u, QWidget* x1 = 0, Qt::WindowFlags x2 = 0) { return new LOpenGLWidget(u, x1, x2); }
Q_INVOKABLE QOpenGLContext* Mcontext(QOpenGLWidget* o) const { return o->context(); }
Q_INVOKABLE int MdefaultFramebufferObject(QOpenGLWidget* o) const { return o->defaultFramebufferObject(); }
Q_INVOKABLE GLuint MdefaultFramebufferObject(QOpenGLWidget* o) const { return o->defaultFramebufferObject(); }
Q_INVOKABLE void MdoneCurrent(QOpenGLWidget* o) { o->doneCurrent(); }
Q_INVOKABLE QSurfaceFormat Mformat(QOpenGLWidget* o) const { return o->format(); }
Q_INVOKABLE QImage MgrabFramebuffer(QOpenGLWidget* o) { return o->grabFramebuffer(); }
@ -4375,7 +4375,7 @@ public:
Q_INVOKABLE void* C(uint u, QOpenGLWindow::UpdateBehavior x1 = QOpenGLWindow::NoPartialUpdate, QWindow* x2 = 0) { return new LOpenGLWindow(u, x1, x2); }
Q_INVOKABLE void* C(uint u, QOpenGLContext* x1, QOpenGLWindow::UpdateBehavior x2 = QOpenGLWindow::NoPartialUpdate, QWindow* x3 = 0) { return new LOpenGLWindow(u, x1, x2, x3); }
Q_INVOKABLE QOpenGLContext* Mcontext(QOpenGLWindow* o) const { return o->context(); }
Q_INVOKABLE int MdefaultFramebufferObject(QOpenGLWindow* o) const { return o->defaultFramebufferObject(); }
Q_INVOKABLE GLuint MdefaultFramebufferObject(QOpenGLWindow* o) const { return o->defaultFramebufferObject(); }
Q_INVOKABLE void MdoneCurrent(QOpenGLWindow* o) { o->doneCurrent(); }
Q_INVOKABLE QImage MgrabFramebuffer(QOpenGLWindow* o) { return o->grabFramebuffer(); }
Q_INVOKABLE bool MisValid(QOpenGLWindow* o) const { return o->isValid(); }