Hi!

Both QOjects and osg::FieldContainers do a lot of things behind the scenes.
For starters they both do automatic deallocation (Qt deletes objects whith
its parents, osg uses refcounts). I would not inherit from both, it feels
like asking for trouble. Instead, I'd have separate classes and let them reference each other. Something like this:


// TextBoxQObject.h

class TextBoxQObject : QObject
{
 Q_OBJECT

private slots:
 void aslot() {
   mTextBox->aslot();
 }

signals:
 void asignal();

private:
 TextBoxQObject(TextBox *box) {
   mTextBox = box;
}

 void emitASignal() {
   emit asignal();
 }

 friend TextBox;
};



// TextBox.h

class TextBox : public TextBoxBase
{
 TextBox() {
    mQObject = new TextBoxQObject(this);
}
 void aslot() {
   // do stuff
   mQObject->emitASignal();
 }

 TextBoxQObject *mQObject;
};


Best regards,

 Johan Grafström



Dirk Reiners wrote:
        Hi Antonio,

On Mon, 2005-11-21 at 16:38 +0100, [EMAIL PROTECTED] wrote:

Hi Dirk,
I create a new field container named TextBox. It is a new core node to render opengl text. this core contain a new field named txtDoc. This field is a QTextDocument of Qt 4.0.0 and it contain formatted text. Of course, this TextBox inherit e TextBoxBase class: class OSG::TextBox : public TextBoxBase
   {
     .....
    }
this is ok. I not have any problem. My project work correctly. then I have tried to inherit from QObject and TextBoxBase in order to use the signal and slot mechanism of qt. My code compile correctly bat fail when I try to create a TextBox core. class OSG::TextBox : public QObject, public TextBoxBase
{
   Q_OBJECT
public:
  TextBox(QObject* parent=0);
TextBox(const TextBox &source, QObject* parent=0);
   .......

}

Can I help me?


I have to pass on this one. I don't have much experience with Qt, and
none with Qt4.

Anybody else?

        Dirk




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to