Hi, all

There is a problem using osgQt in linux. My OS is Fedora 14, and
OpenSceneGraph version is 3.0.1.

Static method QFileDialog::getOpenFileName(.) just doesn't work in osgQt.
It just show a dialog (sometimes blank dialog) without
response to the mouse click.

However, non-static usage of QFileDialog works fine, and so does it in
Windows.
And I tried different thread models, none of which works.

There is a demo to reproduce the problem, which is based on
osgviewerQt.cpp.

===================== test_osgqt.h ===================
class DialogTest : public QObject {
Q_OBJECT
public slots:
void showDialog() {
QFileDialog::getOpenFileName(NULL, ".");
}
};

===================== test_osgqt.cpp ================

class ViewerWidget : public QWidget, public osgViewer::CompositeViewer {
     //same implementation as the osgviewerQt.cpp example
};


#include <QtGui/QMainWindow>
#include <QtGui/QToolBar>
#include <QtGui/QAction>
#include <QtGui/QFileDialog>

#include "test_osgqt.h"
int main( int argc, char** argv )
{
    osg::ArgumentParser arguments(&argc, argv);

    osgViewer::ViewerBase::ThreadingModel threadingModel =
osgViewer::ViewerBase::CullDrawThreadPerContext;
    while (arguments.read("--SingleThreaded")) threadingModel =
osgViewer::ViewerBase::SingleThreaded;
    while (arguments.read("--CullDrawThreadPerContext")) threadingModel =
osgViewer::ViewerBase::CullDrawThreadPerContext;
    while (arguments.read("--DrawThreadPerContext")) threadingModel =
osgViewer::ViewerBase::DrawThreadPerContext;
    while (arguments.read("--CullThreadPerCameraDrawThreadPerContext"))
threadingModel =
osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext;

    QApplication app(argc, argv);
    ViewerWidget* viewWidget = new ViewerWidget(threadingModel);
    viewWidget->setGeometry( 100, 100, 800, 600 );

QMainWindow window;
window.setGeometry(20,20,800,800);
window.setCentralWidget(viewWidget);

QFileDialog* dialog = new QFileDialog;
QToolBar* toolbar = new QToolBar();
window.addToolBar(toolbar);
QAction* open = new QAction("&Open", NULL);
toolbar->addAction(open);

DialogTest t;
app.connect(open, SIGNAL(triggered()), dialog, SLOT(exec()));
app.connect(open, SIGNAL(triggered()), &t, SLOT(showDialog()));

    window.show();
    return app.exec();
}


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

Reply via email to