Hello Martin,

I have tried the way you have suggested i believe:


But ended up having error:


************************************
AdapterWidget.o: In function `AdapterWidget::AdapterWidget(QWidget*, char
const*, QGLWidget const*, QFlags<Qt::WindowType>)':
AdapterWidget.cpp:(.text+0x6c4): undefined reference to `vtable for
AdapterWidget'
AdapterWidget.cpp:(.text+0x6d1): undefined reference to `vtable for
AdapterWidget'
AdapterWidget.o: In function `AdapterWidget::AdapterWidget(QWidget*, char
const*, QGLWidget const*, QFlags<Qt::WindowType>)':
AdapterWidget.cpp:(.text+0x824): undefined reference to `vtable for
AdapterWidget'
AdapterWidget.cpp:(.text+0x831): undefined reference to `vtable for
AdapterWidget'
QTOSGMainWindow.o: In function `Ui_MainWindow::setupUi(QMainWindow*)':
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x229):
undefined reference to `VTT for ViewerQT'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x280):
undefined reference to `vtable for ViewerQT'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x28b):
undefined reference to `vtable for ViewerQT'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x293):
undefined reference to `vtable for ViewerQT'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x29e):
undefined reference to `vtable for ViewerQT'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x2ab):
undefined reference to `vtable for ViewerQT'
QTOSGMainWindow.o:QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x2b6):
more undefined references to `vtable for ViewerQT' follow
QTOSGMainWindow.o: In function `Ui_MainWindow::setupUi(QMainWindow*)':
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x80c):
undefined reference to `vtable for AdapterWidget'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x814):
undefined reference to `vtable for AdapterWidget'
QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x840):
undefined reference to `VTT for ViewerQT'
collect2: ld returned 1 exit status
make: *** [QtAdapter] Error 1



***********************************



The functional version has the following format



********************************************

class ViewerQT :  public osgViewer::Viewer, public AdapterWidget
{
    public:

        ViewerQT(QWidget * parent = 0, const char * name = 0, const
QGLWidget * shareWidget = 0, WindowFlags f = 0):
            AdapterWidget( parent, name, shareWidget, f )
        {
            getCamera()->setViewport(new
osg::Viewport(0,0,width(),height()));
            getCamera()->setProjectionMatrixAsPerspective(30.0f,
static_cast<double>(width())/static_cast<double>(height()), 1.0f, 10000.0f);
            .....................................................


           ......................................................






#ifndef QTOSGMAINWINDOW_H
#define QTOSGMAINWINDOW_H

#include "ui_MainWindow.h"

class QTOSGMainWindow : public QMainWindow
{
Q_OBJECT

  public:

  QTOSGMainWindow(QWidget *parent = 0);

  ~QTOSGMainWindow();

  protected:


  private slots:

  void open();

  private:


  void loadFile(const QString &fileName);

  osg::ref_ptr<osg::Node> createSceneGraph(osg::Node*);

  Ui::MainWindow ui;


  QString currFile;

};


#endif




*******************************************



Any Hint ?



Sajjad

---------- Forwarded message ----------
From: <[email protected]>
Date: Mon, Oct 27, 2008 at 10:10 PM
Subject: [osg-users] QT4 ViewerQOSG and Q_OBJECT
To: [email protected]


Not a question so much as a note for the archives.

If you want ViewerQOSG to be able to handle signals it must have a Q_OBJECT
definition.
In order to do this the viewerQT example must swap the order of the
definition
to "class ViewerQOSG : public QOSGWidget, public osgViewer::Viewer"
The QT moc assumes that the parent class derived from QObject is first in
the list.

In addition QOSGWidget must not have a Q_OBJECT since you cannot inherit
from multiple Q_OBJECT defined classes.

Martin


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to