[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Problems with pointers to c++ objects
From: |
Petter Egesund |
Subject: |
[Chicken-users] Problems with pointers to c++ objects |
Date: |
Thu, 29 Jul 2004 22:42:15 +0000 |
Hi;
I have followed Felix' good example, and used the Qt-examples as a tutorial
for using C++ objects from Scheme.
But I have problems with functions defined like this;
QFont (const QString &, int pointSize, int weight, bool italic);
They need the pointer to a created object, rather than the object itself.
I have looked through the mailing list, but my failed attempt to create a
pointer to a font-object does not seem to work.
Any clues on this one?
Cheers,
Petter Egesund
----
My program looks like this:
; Include into generated code, but don't parse:
#>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <qvbox.h>
<#
; Parse but don't embed: we only want wrappers for a few classes:
#>?
class QString
{
public:
QString (const char *);
~QString();
};
class QFont
{
public:
QFont (const QString &, int pointSize, int weight, bool italic);
~QFont();
};
class QObject
{
public:
bool connect(const QObject *, const char *, const char *) const;
};
class QWidget
{
public:
void resize(int, int);
void show();
void setFont (const QFont &);
};
class QApplication : QObject
{
public:
QApplication(int, char **);
~QApplication();
void setMainWidget(QWidget *);
void exec();
};
class QPushButton : public QWidget
{
public:
QPushButton(char *, QWidget *);
~QPushButton();
bool connect(const QObject *, const char *, const char *);
}
class QVBox: public QWidget
{
public:
QVBox(QWidget *, const char *, int);
~QVBox();
}
<#
(define a (apply make <QApplication> (receive (argc+argv))))
(define hello (make <QPushButton> "hello world!" #f))
(define the_font_name
(let ([a (make <QString> 'this a "Times")])
a))
(define the_font (make <QFont> the_font_name 18 50 #f))
(resize hello 100 30)
(connect a hello "2clicked()" "1closeAllWindows()")
(setMainWidget a hello)
(show hello)
(exec a)
(destroy hello)
(destroy a)
_________________________________________________________________
MSN Hotmail http://www.hotmail.com Med markedets beste SPAM-filter. Gratis!
- [Chicken-users] Problems with pointers to c++ objects,
Petter Egesund <=