the following works just fine for me. It could very well be because
MyClass is derived from QObject.
class MyClass : public QObject
{
Q_OBJECT
signals:
void bleh(MyClass &);
};
class MyOtherClass : public MyClass
{
public:
void uhhuh()
{
emit bleh(*this);
}
};
class Printer : public QObject
{
Q_OBJECT
public slots:
void printme()
{
qDebug("weeeee!");
QCoreApplication::instance()->quit();
}
};
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
MyOtherClass a;
Printer printer;
QObject::connect(&a, SIGNAL(bleh(MyClass &)),
&printer, SLOT(printme()));
a.uhhuh();
app.exec();
}
On 7/19/06, Malte Witt <malte.witt@xxxxxxxxxxxxx> wrote:
> Why don't you simply define your signals as
> void fooThingCreated(const AbstractThing &foo);
> void barThingChanged(const AbstractThing &bar);
> void bazThingClicked(const AbstractThing &baz);
... and if you need some more specific thing somewhere, just use
qobject_cast<WhateverThingy *>(&foo). But this is not even necessary in
the given example. I'd really encourage you to use the abstract thing in
your signals. It even seems a better design to me.
Regards,
Malte
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
--
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
|