You need intermediate slot to capture button click and from that slot emit signal with position constructed from values entered in your spin boxes:
// header
public slots:
void onButtonClicked( void );
void add_camera( const Ogre::Vector3& pos ); // it's just a concept, this slot should be in different class as otherwise there's no point using signals/slots
signals:
void addCameraAt( const Ogre::Vector3& pos );
// header
public slots:
void onButtonClicked( void );
void add_camera( const Ogre::Vector3& pos ); // it's just a concept, this slot should be in different class as otherwise there's no point using signals/slots
signals:
void addCameraAt( const Ogre::Vector3& pos );
To copy to clipboard, switch view to plain text mode
// connection
connect( buttonWithMagicNumber, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
connect( this, SIGNAL( addCameraAt( Ogre::Vector3 ) ), this, SLOT( add_camera( Ogre::Vector3 ) ) );
// connection
connect( buttonWithMagicNumber, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
connect( this, SIGNAL( addCameraAt( Ogre::Vector3 ) ), this, SLOT( add_camera( Ogre::Vector3 ) ) );
To copy to clipboard, switch view to plain text mode
// slot implementation
void onButtonClicked( void )
{
emit addCameraAt(
Ogre::Vector3(
this->doubleSpinBox->value(),
this->doubleSpinBox2->value(),
this->doubleSpinBox3->value()
) );
}
// slot implementation
void onButtonClicked( void )
{
emit addCameraAt(
Ogre::Vector3(
this->doubleSpinBox->value(),
this->doubleSpinBox2->value(),
this->doubleSpinBox3->value()
) );
}
To copy to clipboard, switch view to plain text mode
You will have to register Ogre::Vector3 type to use it with signals and slots (see qRegisterMetaType for more details).
If you already read the documentation for signals and slots, go back and read it again.
And again.
Bookmarks