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 

QT4 ViewerQOSG and Q_OBJECT


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
mgb
Guest





PostPosted: Mon Oct 27, 2008 8:10 pm    Post subject:
QT4 ViewerQOSG and Q_OBJECT
Reply with quote

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




------------------
Post generated by Mail2Forum
Back to top
Robert Osfield
Guest





PostPosted: Tue Oct 28, 2008 9:15 am    Post subject:
QT4 ViewerQOSG and Q_OBJECT
Reply with quote

Hi Martin,

Could you post complete modified file as this will explain the changes
without any chance of ambiguity.

Thanks,
Robert.

On Mon, Oct 27, 2008 at 8:10 PM, <> wrote:
Quote:
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






------------------
Post generated by Mail2Forum
Back to top
mgb
Guest





PostPosted: Tue Oct 28, 2008 11:49 pm    Post subject:
QT4 ViewerQOSG and Q_OBJECT
Reply with quote

ViewerQOSG declaration in QOSGWidget.h separated out from QOSGWidget.cpp
To use the QT moc class definitions must each be in their own header.

// Parent class derived from QObject must come first.
class ViewerQOSG : public QOSGWidget,public osgViewer::Viewer
{
//Include this if you want to emit signals, but file will have to go through the moc
//Q_OBJECT

public:
ViewerQOSG(QWidget * parent = 0, const char * name = 0, WindowFlags f = 0):
QOSGWidget( parent, name, f )
{
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));

// This line causes the image to be stretched vertically on Nvidia (but not ATI) on XP!
//getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width())
static_cast<double>(height()), 1.0f, 10000.0f);
getCamera()->setGraphicsContext(getGraphicsWindow());
setThreadingModel(osgViewer::Viewer::SingleThreaded);

connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
_timer.start(10);
}
virtual void paintEvent( QPaintEvent * event ) { frame(); }

protected:
QTimer _timer;
};

--------------------------------------
Martin



------------------
Post generated by Mail2Forum
Back to top
Robert Osfield
Guest





PostPosted: Wed Oct 29, 2008 9:18 am    Post subject:
QT4 ViewerQOSG and Q_OBJECT
Reply with quote

Hi Martin,

As I said previously, could you post whole files, I can then do an
graphical diff to see your exact changes without any possibility for
copy and paste errors.

Robert.

On Tue, Oct 28, 2008 at 11:49 PM, <> wrote:
Quote:
ViewerQOSG declaration in QOSGWidget.h separated out from QOSGWidget.cpp
To use the QT moc class definitions must each be in their own header.

// Parent class derived from QObject must come first.
class ViewerQOSG : public QOSGWidget,public osgViewer::Viewer
{
//Include this if you want to emit signals, but file will have to go through the moc
//Q_OBJECT

public:
ViewerQOSG(QWidget * parent = 0, const char * name = 0, WindowFlags f = 0):
QOSGWidget( parent, name, f )
{
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));

// This line causes the image to be stretched vertically on Nvidia (but not ATI) on XP!
//getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width())
static_cast<double>(height()), 1.0f, 10000.0f);
getCamera()->setGraphicsContext(getGraphicsWindow());
setThreadingModel(osgViewer::Viewer::SingleThreaded);

connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
_timer.start(10);
}
virtual void paintEvent( QPaintEvent * event ) { frame(); }

protected:
QTimer _timer;
};

--------------------------------------
Martin





------------------
Post generated by Mail2Forum
Back to top
mgb
Guest





PostPosted: Fri Oct 31, 2008 3:58 am    Post subject:
QT4 ViewerQOSG and Q_OBJECT
Reply with quote

Quote:
Could you post complete modified file as this will explain the changes
without any chance of ambiguity.
Sorry my mistake,
Note if you want to use QT_OBJECT the ViewerQOSG class declaration
should be in it's own header file.




------------------
Post generated by Mail2Forum
Back to top
Robert Osfield
Guest





PostPosted: Fri Oct 31, 2008 9:37 am    Post subject:
QT4 ViewerQOSG and Q_OBJECT
Reply with quote

HI MMBMGH

Could you sign your posts with the name your wish to be address as, it
helps us keep track of who's who and keep discussions more friendly.

Also could try to reply to previous posts in a thread, as just posting
an email in a new thread, that requires info from the other thread to
understand it makes things really had for others to understand things
without doing lots of detective work. I for one have to read my
dozens of emails each day on as many different topics, each topic only
take a small slice of my time otherwise I end up totally bogged down.

Robert.

On Fri, Oct 31, 2008 at 3:57 AM, <> wrote:
Quote:
Quote:
Could you post complete modified file as this will explain the changes
without any chance of ambiguity.
Sorry my mistake,
Note if you want to use QT_OBJECT the ViewerQOSG class declaration
should be in it's own header file.







------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General 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 Happy New Year to all OSG Users Chris Hanson General 0 Mon Jan 07, 2019 10:17 am View latest post
No new posts osg-users Digest, Vol 138, Issue 27 Zachary1234 General 0 Tue Jan 01, 2019 1:16 am View latest post
No new posts osg-users Digest, Vol 137, Issue 14 poweruserm@live.com.au General 0 Fri Nov 16, 2018 11:16 pm View latest post
No new posts General Users starting questions in O... A Z General 1 Mon Oct 15, 2018 3:59 am View latest post
No new posts osg-users Digest, Vol 136, Issue 8 jonasydy General 0 Wed Oct 10, 2018 12:40 am 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