parent
7e19dd1a92
commit
e0fca00772
4
main.cpp
4
main.cpp
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <QtGui>
|
||||
#include <QtUiTools>
|
||||
#include <QLayout>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QtMultimedia/QSoundEffect>
|
||||
#include <chicken.h>
|
||||
|
@ -70,6 +71,7 @@ protected:
|
|||
#define qtsound QSoundEffect *
|
||||
#define qttextedit QTextEdit *
|
||||
#define qtaction QAction *
|
||||
#define qtlayout QLayout *
|
||||
|
||||
extern "C" {
|
||||
#include "prototypes.h"
|
||||
|
@ -494,6 +496,8 @@ char *qt_listwidgetitem(qtwidget w, int i) {
|
|||
return qstrdata(((QListWidget *)w)->item(i)->text());
|
||||
}
|
||||
|
||||
void qt_addlayoutwidget(qtlayout l, qtwidget w) { l->addWidget(w); }
|
||||
|
||||
qtsound qt_sound(char *filename) {
|
||||
QSoundEffect* sound = new QSoundEffect();
|
||||
sound->setSource(QUrl::fromLocalFile(filename));
|
||||
|
|
|
@ -56,6 +56,7 @@ void qt_addcomboboxitem(qtwidget w, char *s);
|
|||
void qt_addlistwidgetitem(qtwidget w, char *s);
|
||||
void qt_addtreewidgetitem(qtwidget w, char *s);
|
||||
char *qt_listwidgetitem(qtwidget w, int i);
|
||||
void qt_addlayoutwidget(qtlayout l, qtwidget w);
|
||||
char *qt_getexistingdirectory(qtwidget p, char *cap, char *dir, int opts);
|
||||
char *qt_getopenfilename(qtwidget p, char *cap, char *dir, char *filter, int opts);
|
||||
char *qt_getsavefilename(qtwidget p, char *cap, char *dir, char *filter, int opts);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
(define <qt>
|
||||
(% (current-root-object)
|
||||
(% (current-root-object)
|
||||
(class '<qt>)
|
||||
(pointer #f)
|
||||
(print (lambda (self #!optional (port (current-output-port)))
|
||||
|
@ -49,9 +49,11 @@
|
|||
(define <qt-timer> (% <qt-object> (class 'qt-timer)))
|
||||
(define <qt-text-edit> (% <qt-widget> (class 'qt-text-edit)))
|
||||
(define <qt-action> (% <qt-object> (class 'qt-action)))
|
||||
(define <qt-layout> (% <qt-object> (class 'qt-layout)))
|
||||
|
||||
(define (qt:->pointer i) (and i (? i pointer)))
|
||||
(define (qt:pointer->widget p) (and p (% <qt-widget> (pointer p))))
|
||||
(define (qt:pointer->layout p) (and p (% <qt-layout> (pointer p))))
|
||||
(define (qt:pointer->object p) (and p (% <qt-object> (pointer p))))
|
||||
(define (qt:pointer->timer p) (and p (% <qt-timer> (pointer p))))
|
||||
(define (qt:pointer->application p) (and p (% <qt-application> (pointer p))))
|
||||
|
@ -68,6 +70,7 @@
|
|||
(bind-type qtapplication c-pointer qt:->pointer qt:pointer->application)
|
||||
(bind-type qtpixmap c-pointer qt:->pointer qt:pointer->pixmap)
|
||||
(bind-type qticon c-pointer qt:->pointer qt:pointer->icon)
|
||||
(bind-type qtlayout c-pointer qt:->pointer qt:pointer->layout)
|
||||
(bind-type qtobject c-pointer qt:->pointer qt:pointer->object)
|
||||
(bind-type qttimer c-pointer qt:->pointer qt:pointer->timer)
|
||||
(bind-type qtreceiver c-pointer qt:->pointer qt:pointer->receiver)
|
||||
|
@ -118,6 +121,8 @@ extern "C" {
|
|||
(qt:pointer->widget (qt:->pointer result)))
|
||||
((qt:inherits result "QAction")
|
||||
(qt:pointer->action (qt:->pointer result)))
|
||||
((qt:inherits result "QLayout")
|
||||
(qt:pointer->layout (qt:->pointer result)))
|
||||
(#t
|
||||
result))
|
||||
result)))))
|
||||
|
@ -215,6 +220,7 @@ extern "C" {
|
|||
(cond ((qt:inherits w "QComboBox") (qt:addcomboboxitem w x))
|
||||
((qt:inherits w "QListWidget") (qt:addlistwidgetitem w x))
|
||||
((qt:inherits w "QTreeWidget") (qt:addtreewidgetitem w x))
|
||||
((qt:inherits w "QLayout") (qt:addlayoutwidget w x))
|
||||
(else (error 'qt:add "invalid widget" w x)) ) )
|
||||
|
||||
(define (qt:item w i) (and (positive? i) (qt:listwidgetitem w i)))
|
||||
|
|
Ŝarĝante…
Reference in New Issue