OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Qt Form integration


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [3rdparty]
View previous topic :: View next topic  
Author Message
oelmas
Newbie


Joined: 14 Mar 2014
Posts: 4

PostPosted: Mon Mar 24, 2014 9:19 am    Post subject:
Qt Form integration
Reply with quote

Hi,

I want to ask is there a way to OSG as a widget in Qt form (I mean how can I promote OSG header to QWidget to put Qt from and use QT button and the other stuff). I try to show some point clouds and make some modification

Thank you!

Cheers,
oner
Back to top
View user's profile Send private message
oelmas
Newbie


Joined: 14 Mar 2014
Posts: 4

PostPosted: Wed Apr 09, 2014 10:26 am    Post subject:
Qt Form integration
Reply with quote

Hi,

I want to ask is there a way to OSG as a widget in Qt form (I mean how can I promote OSG header to QWidget to put Qt from and use QT button and the other stuff). I try to show some point clouds and make some modification

Thank you!

Cheers,
oner

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=58704#58704







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Fawkes
Newbie


Joined: 14 Apr 2015
Posts: 16

PostPosted: Tue Apr 14, 2015 12:39 pm    Post subject:
Reply with quote

Hi,

I´m also interested in this topic. Is there a way to use the forms editor of the qt creator to display and integrate a OSG Scene?

Link seems to go on the same thread...?

I already looked into the example osgviewerQt. Has anyone a link to deeper examples of Qt and OSG integration?

...


Thank you!

Cheers,
Christian[/url]
Back to top
View user's profile Send private message
Alistair Baxter
Guest





PostPosted: Tue Apr 14, 2015 4:09 pm    Post subject:
Qt Form integration
Reply with quote

osgQt doesn't have a Qt Designer plugin for its GLWidget-derived class, so you can't plug it into your edited layouts directly.

You could probably try to create your own one, using the guidelines here: http://doc.qt.io/qt-4.8/designer-creating-custom-widgets.html

But a far easier option is just to leave a blank widget in the space where you want your osgQt widget to go and add it as a child after you've loaded your form in code.


------------------
Post generated by Mail2Forum
Back to top
Fawkes
Newbie


Joined: 14 Apr 2015
Posts: 16

PostPosted: Wed Apr 15, 2015 8:42 am    Post subject:
Reply with quote

Hi Alistair,

thanks for your reply. Your solution seems way easier. Do you have an example how to do that?

I used now a different example: http://trac.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgviewerQt/osgviewerQt.cpp

In my Code i tried to add the new widget to an existent widget in a form.
Unfortunately the program crahses and I don´t know why:


Code:
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{


#if QT_VERSION >= 0x050000
    // Qt5 is currently crashing and reporting "Cannot make QOpenGLContext current in a different thread" when the viewer is run multi-threaded, this is regression from Qt4
    osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::SingleThreaded;
#else
    osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::CullDrawThreadPerContext;
#endif



#if QT_VERSION >= 0x040800
    // Required for multithreaded QGLWidget on Linux/X11, see http://blog.qt.io/blog/2011/06/03/threaded-opengl-in-4-8/
    if (threadingModel != osgViewer::ViewerBase::SingleThreaded)
        QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif



    ViewerWidget* viewWidget = new ViewerWidget(ui->widgetCarrier, Qt::Widget, threadingModel);
    viewWidget->setGeometry( 100, 100, 800, 600 );
    viewWidget->show();

    ui->setupUi(this);
}


widgetCarrier is just a QWidget I dragged into the MainWindow.

Any suggestions?

...


Thank you!

Cheers,
Christian[/code]
Back to top
View user's profile Send private message
Alistair Baxter
Guest





PostPosted: Thu Apr 16, 2015 11:48 am    Post subject:
Qt Form integration
Reply with quote

The bundled osgViewerQt example adds viewer widgets to a grid layout. All you need do is to change it to set up an equivalent to class ViewerWidget which loads a layout from a ui file, as per the examples here: http://doc.qt.io/qt-5/designer-using-a-ui-file.html

-----Original Message-----
From: osg-users [mailto:] On Behalf Of Christian Kunz
Sent: 15 April 2015 09:42
To:
Subject: Re: [3rdparty] Qt Form integration

Hi Alistair,

thanks for your reply. Your solution seems way easier. Do you have an example how to do that?


...


Thank you!

Cheers,
Christian


------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [3rdparty] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Loading problem, OpenVR integration Oneiros General 8 Wed Nov 02, 2016 4:59 pm View latest post
No new posts VR headset integration cbuchner1 General 7 Wed Mar 30, 2016 1:26 pm View latest post
No new posts mygui integration (for Wang Rui) eugustus General 27 Mon Nov 09, 2015 7:03 pm View latest post
No new posts Chromium Embedded Framework (CEF3) i... aquawicket General [3rdparty] 2 Fri Sep 18, 2015 8:03 pm View latest post
No new posts AutoTransform can't leave unchanged t... poljak181 General 0 Sun Aug 23, 2015 9:41 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP