Commit 75600d96 authored by schurade's avatar schurade

[CHANGE] use QString for signals inside the gui

parent d973edab
......@@ -100,11 +100,11 @@ void WMainWindow::setupGUI( QMainWindow *mainWindow )
connect( m_toolBar->getCorButton(), SIGNAL( toggled( bool ) ), this, SLOT( toggleCoronal( bool ) ) );
connect( m_toolBar->getSagButton(), SIGNAL( toggled( bool ) ), this, SLOT( toggleSagittal( bool ) ) );
connect( m_navAxial, SIGNAL( navSliderValueChanged( std::string, int ) ), m_propertyManager, SLOT( slotIntChanged( std::string, int ) ) );
connect( m_navCoronal, SIGNAL( navSliderValueChanged( std::string, int ) ), m_propertyManager, SLOT( slotIntChanged( std::string, int ) ) );
connect( m_navSagittal, SIGNAL( navSliderValueChanged( std::string, int ) ), m_propertyManager, SLOT( slotIntChanged( std::string, int ) ) );
connect( m_navAxial, SIGNAL( navSliderValueChanged( QString, int ) ), m_propertyManager, SLOT( slotIntChanged( QString, int ) ) );
connect( m_navCoronal, SIGNAL( navSliderValueChanged( QString, int ) ), m_propertyManager, SLOT( slotIntChanged( QString, int ) ) );
connect( m_navSagittal, SIGNAL( navSliderValueChanged( QString, int ) ), m_propertyManager, SLOT( slotIntChanged( QString, int ) ) );
connect( m_datasetBrowser, SIGNAL( dataSetBrowserEvent( std::string, bool ) ), m_propertyManager, SLOT( slotBoolChanged( std::string, bool ) ) );
connect( m_datasetBrowser, SIGNAL( dataSetBrowserEvent( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
}
......
......@@ -40,34 +40,34 @@ void WPropertyManager::connectProperties( WProperties* properties )
m_connectedProperties.push_back( properties );
}
void WPropertyManager::slotBoolChanged( std::string name, bool value )
void WPropertyManager::slotBoolChanged( QString name, bool value )
{
for ( size_t i = 0; i < m_connectedProperties.size(); ++i )
{
m_connectedProperties[i]->setValue( name, value );
m_connectedProperties[i]->setValue( name.toStdString(), value );
}
}
void WPropertyManager::slotIntChanged( std::string name, int value )
void WPropertyManager::slotIntChanged( QString name, int value )
{
for ( size_t i = 0; i < m_connectedProperties.size(); ++i )
{
m_connectedProperties[i]->setValue( name, value );
m_connectedProperties[i]->setValue( name.toStdString(), value );
}
}
void WPropertyManager::slotFloatChanged( std::string name, float value )
void WPropertyManager::slotFloatChanged( QString name, float value )
{
for ( size_t i = 0; i < m_connectedProperties.size(); ++i )
{
m_connectedProperties[i]->setValue( name, value );
m_connectedProperties[i]->setValue( name.toStdString(), value );
}
}
void WPropertyManager::slotStringChanged( std::string name, std::string value )
void WPropertyManager::slotStringChanged( QString name, QString value )
{
for ( size_t i = 0; i < m_connectedProperties.size(); ++i )
{
m_connectedProperties[i]->setValue( name, value );
m_connectedProperties[i]->setValue( name.toStdString(), value.toStdString() );
}
}
......@@ -60,22 +60,22 @@ public slots:
* slot function that writes a boolean value to all properties objects that contain an entry
* with that name
*/
void slotBoolChanged( std::string name, bool value );
void slotBoolChanged( QString name, bool value );
/**
* slot function that writes a integer value to all properties objects that contain an entry
* with that name
*/
void slotIntChanged( std::string name, int value );
void slotIntChanged( QString name, int value );
/**
* slot function that writes a float value to all properties objects that contain an entry
* with that name
*/
void slotFloatChanged( std::string name, float value );
void slotFloatChanged( QString name, float value );
/**
* slot function that writes a string value to all properties objects that contain an entry
* with that name
*/
void slotStringChanged( std::string name, std::string value );
void slotStringChanged( QString name, QString value );
protected:
......
......@@ -33,7 +33,7 @@
WQtNavGLWidget::WQtNavGLWidget( QString title, int maxValue, std::string sliderTitle )
: QDockWidget( title )
{
m_sliderTitle = sliderTitle;
m_sliderTitle = QString( sliderTitle.c_str() );
setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
......@@ -63,7 +63,7 @@ WQtNavGLWidget::~WQtNavGLWidget()
void WQtNavGLWidget::setSliderTitle( std::string title )
{
m_sliderTitle = title;
m_sliderTitle = QString( title.c_str() );
}
boost::shared_ptr<WQtGLWidget>WQtNavGLWidget::getGLWidget()
......
......@@ -60,7 +60,7 @@ public:
protected:
private:
std::string m_sliderTitle;
QString m_sliderTitle;
boost::shared_ptr<WQtGLWidget> m_glWidget;
......@@ -68,7 +68,7 @@ private slots:
void sliderValueChanged( int value );
signals:
void navSliderValueChanged( std::string name, int value );
void navSliderValueChanged( QString name, int value );
};
#endif // WQTNAVGLWIDGET_H
......@@ -37,7 +37,7 @@ WQtCheckBox::~WQtCheckBox()
{
}
void WQtCheckBox::setName( std::string name )
void WQtCheckBox::setName( QString name )
{
m_name = name;
}
......
......@@ -50,10 +50,10 @@ public:
/**
* setter for name
*/
void setName( std::string name );
void setName( QString name );
private:
std::string m_name;
QString m_name;
......@@ -61,7 +61,7 @@ public slots:
void emitStateChanged();
signals:
void checkBoxStateChanged( std::string name, bool value );
void checkBoxStateChanged( QString name, bool value );
};
#endif // WQTCHECKBOX_H
......@@ -41,12 +41,12 @@ WQtDSBWidget::~WQtDSBWidget()
}
QPushButton* WQtDSBWidget::addPushButton( std::string label )
QPushButton* WQtDSBWidget::addPushButton( QString label )
{
int row = m_layout.rowCount();
QPushButton* button = new QPushButton();
button->setText( QString( label.c_str() ) );
button->setText( label );
m_layout.addWidget( button, row, 0 );
......@@ -55,10 +55,10 @@ QPushButton* WQtDSBWidget::addPushButton( std::string label )
}
WQtCheckBox* WQtDSBWidget::addCheckBox( std::string label, bool isChecked )
WQtCheckBox* WQtDSBWidget::addCheckBox( QString label, bool isChecked )
{
int row = m_layout.rowCount();
QLabel* qlabel = new QLabel( label.c_str() );
QLabel* qlabel = new QLabel( label );
WQtCheckBox* checkBox = new WQtCheckBox();
checkBox->setName( label );
......@@ -73,14 +73,14 @@ WQtCheckBox* WQtDSBWidget::addCheckBox( std::string label, bool isChecked )
}
WQtLineEdit* WQtDSBWidget::addLineEdit( std::string label, std::string text )
WQtLineEdit* WQtDSBWidget::addLineEdit( QString label, QString text )
{
int row = m_layout.rowCount();
QLabel* qlabel = new QLabel( label.c_str() );
QLabel* qlabel = new QLabel( label );
WQtLineEdit* lineEdit = new WQtLineEdit();
lineEdit->setName( label );
lineEdit->setText( QString( text.c_str() ) );
lineEdit->setText( text );
m_layout.addWidget( qlabel, row, 0 );
m_layout.addWidget( lineEdit, row, 1 );
......@@ -91,10 +91,10 @@ WQtLineEdit* WQtDSBWidget::addLineEdit( std::string label, std::string text )
}
WQtSliderWithEdit* WQtDSBWidget::addSliderInt( std::string label, int value, int min, int max )
WQtSliderWithEdit* WQtDSBWidget::addSliderInt( QString label, int value, int min, int max )
{
int row = m_layout.rowCount();
QLabel* qlabel = new QLabel( label.c_str() );
QLabel* qlabel = new QLabel( label );
WQtSliderWithEdit* slider = new WQtSliderWithEdit( label );
......
......@@ -60,22 +60,22 @@ public:
/**
* helper function to add a generic button
*/
QPushButton* addPushButton( std::string label = "button" );
QPushButton* addPushButton( QString label );
/**
* helper function to add a generic checkbox
*/
WQtCheckBox* addCheckBox( std::string label = "checkbox:", bool isChecked = false );
WQtCheckBox* addCheckBox( QString label, bool isChecked = false );
/**
* helper function to add a generic line edit
*/
WQtLineEdit* addLineEdit( std::string label = "edit text:", std::string text = "" );
WQtLineEdit* addLineEdit( QString label, QString text = QString( "" ) );
/**
* helper function to add a slider with a connect line edit
*/
WQtSliderWithEdit* addSliderInt( std::string label = "", int value = 0, int min = 0, int max = 100 );
WQtSliderWithEdit* addSliderInt( QString label, int value = 0, int min = 0, int max = 100 );
/**
* getter for m_name
......
......@@ -99,6 +99,7 @@ WQtDatasetTreeItem* WQtDatasetBrowser::addDataset( boost::shared_ptr< WModule >
{
WQtSubjectTreeItem* subject = ( WQtSubjectTreeItem* )m_treeWidget->topLevelItem( subjectId );
subject->setExpanded( true );
emit dataSetBrowserEvent( QString( "textureChanged" ), true );
return subject->addDatasetItem( module );
}
......@@ -122,9 +123,9 @@ void WQtDatasetBrowser::selectTreeItem()
{
case P_BOOL:
{
WQtCheckBox* box = tab1->addCheckBox( props->at( i )->getName(), props->at( i )->getValue<bool>() );
connect( box, SIGNAL( checkBoxStateChanged( std::string, bool ) ),
this, SLOT( slotSetBoolProperty( std::string, bool ) ) );
QString name = QString( props->at( i )->getName().c_str() );
WQtCheckBox* box = tab1->addCheckBox( name, props->at( i )->getValue<bool>() );
connect( box, SIGNAL( checkBoxStateChanged( QString, bool ) ), this, SLOT( slotSetBoolProperty( QString, bool ) ) );
break;
}
case P_CHAR:
......@@ -133,10 +134,10 @@ void WQtDatasetBrowser::selectTreeItem()
break;
case P_INT:
{
WQtSliderWithEdit* slider = tab1->addSliderInt( props->at( i )->getName(), props->at( i )->getValue<int>(),
QString name = QString( props->at( i )->getName().c_str() );
WQtSliderWithEdit* slider = tab1->addSliderInt( name, props->at( i )->getValue<int>(),
props->at( i )->getMin<int>(), props->at( i )->getMax<int>() );
connect( slider, SIGNAL( signalNumberWithName( std::string, int ) ),
this, SLOT( slotSetIntProperty( std::string, int ) ) );
connect( slider, SIGNAL( signalNumberWithName( QString, int ) ), this, SLOT( slotSetIntProperty( QString, int ) ) );
break;
}
case P_UNSIGNED_INT:
......@@ -147,9 +148,10 @@ void WQtDatasetBrowser::selectTreeItem()
break;
case P_STRING:
{
WQtLineEdit* edit = tab1->addLineEdit( props->at( i )->getName(), props->at( i )->getValue<std::string>() );
connect( edit, SIGNAL( lineEditStateChanged( std::string, std::string ) ),
this, SLOT( slotSetStringProperty( std::string, std::string ) ) );
QString name = QString( props->at( i )->getName().c_str() );
QString text = QString( props->at( i )->getValue<std::string>().c_str() );
WQtLineEdit* edit = tab1->addLineEdit( name, text );
connect( edit, SIGNAL( lineEditStateChanged( QString, QString ) ), this, SLOT( slotSetStringProperty( QString, QString ) ) );
break;
}
default:
......@@ -178,7 +180,7 @@ void WQtDatasetBrowser::changeTreeItem()
{
module->getProperties()->setValue<bool>( "active", false );
}
emit dataSetBrowserEvent( "textureChanged", true );
emit dataSetBrowserEvent( QString( "textureChanged" ), true );
// selectTreeItem();
}
......@@ -187,18 +189,18 @@ void WQtDatasetBrowser::addTabWidgetContent( WQtDSBWidget* content )
m_tabWidget->addTab( content, content->getName() );
}
void WQtDatasetBrowser::slotSetIntProperty( std::string name, int value )
void WQtDatasetBrowser::slotSetIntProperty( QString name, int value )
{
boost::shared_ptr< WModule >module =( ( WQtDatasetTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
module->getProperties()->setValue<int>( name, value );
module->getProperties()->setValue<int>( name.toStdString(), value );
emit dataSetBrowserEvent( "textureChanged", true );
emit dataSetBrowserEvent( QString( "textureChanged" ), true );
}
void WQtDatasetBrowser::slotSetBoolProperty( std::string name, bool value )
void WQtDatasetBrowser::slotSetBoolProperty( QString name, bool value )
{
boost::shared_ptr< WModule >module =( ( WQtDatasetTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
module->getProperties()->setValue<bool>( name, value );
module->getProperties()->setValue<bool>( name.toStdString(), value );
if ( name == "active")
{
......@@ -211,17 +213,17 @@ void WQtDatasetBrowser::slotSetBoolProperty( std::string name, bool value )
m_treeWidget->selectedItems().at( 0 )->setCheckState( 0, Qt::Unchecked );
}
}
emit dataSetBrowserEvent( "textureChanged", true );
emit dataSetBrowserEvent( QString( "textureChanged" ), true );
}
void WQtDatasetBrowser::slotSetStringProperty( std::string name, std::string value )
void WQtDatasetBrowser::slotSetStringProperty( QString name, QString value )
{
boost::shared_ptr< WModule >module =( ( WQtDatasetTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
module->getProperties()->setValue<std::string>( name, value );
module->getProperties()->setValue<std::string>( name.toStdString(), value.toStdString() );
if ( name == "name")
{
m_treeWidget->selectedItems().at( 0 )->setText( 0, QString( value.c_str() ) );
m_treeWidget->selectedItems().at( 0 )->setText( 0, value );
}
}
......
......@@ -86,9 +86,9 @@ public:
void connectSlots();
public slots:
void slotSetIntProperty( std::string name, int value );
void slotSetBoolProperty( std::string name, bool value );
void slotSetStringProperty( std::string name, std::string value );
void slotSetIntProperty( QString name, int value );
void slotSetBoolProperty( QString name, bool value );
void slotSetStringProperty( QString name, QString value );
protected:
......@@ -118,7 +118,7 @@ private slots:
void changeTreeItem();
signals:
void dataSetBrowserEvent( std::string name, bool value );
void dataSetBrowserEvent( QString name, bool value );
};
#endif // WQTDATASETBROWSER_H
......@@ -49,10 +49,6 @@ public:
*/
boost::shared_ptr< WModule >getModule();
/**
* helper function to signal this item has been selected
*/
void emitSelect();
protected:
private:
boost::shared_ptr< WModule >m_module;
......
......@@ -29,7 +29,7 @@
WQtLineEdit::WQtLineEdit()
: QLineEdit()
{
m_name = "";
m_name = QString( "" );
connect( this, SIGNAL( textEdited( QString ) ), this, SLOT( emitStateChanged() ) );
}
......@@ -37,13 +37,12 @@ WQtLineEdit::~WQtLineEdit()
{
}
void WQtLineEdit::setName( std::string name )
void WQtLineEdit::setName( QString name )
{
m_name = name;
}
void WQtLineEdit::emitStateChanged()
{
std::string text = std::string( this->text().toLatin1() );
emit lineEditStateChanged( m_name, text );
emit lineEditStateChanged( m_name, this->text() );
}
......@@ -50,16 +50,16 @@ public:
/**
* setter for name
*/
void setName( std::string name );
void setName( QString name );
private:
std::string m_name;
QString m_name;
public slots:
void emitStateChanged();
signals:
void lineEditStateChanged( std::string name, std::string text );
void lineEditStateChanged( QString name, QString text );
};
#endif // WQTLINEEDIT_H
......@@ -26,7 +26,7 @@
#include "WQtSliderWithEdit.h"
WQtSliderWithEdit::WQtSliderWithEdit( std::string name, QWidget* parent )
WQtSliderWithEdit::WQtSliderWithEdit( QString name, QWidget* parent )
: QWidget( parent ),
m_slider( Qt::Horizontal ),
m_edit(),
......@@ -51,7 +51,7 @@ WQtSliderWithEdit::~WQtSliderWithEdit()
{
}
void WQtSliderWithEdit::setName( std::string name )
void WQtSliderWithEdit::setName( QString name )
{
m_name = name;
}
......
......@@ -42,7 +42,7 @@ public:
/**
* default constructor
*/
explicit WQtSliderWithEdit( std::string name, QWidget* parent = 0 );
explicit WQtSliderWithEdit( QString name, QWidget* parent = 0 );
/**
* destructor
......@@ -52,7 +52,7 @@ public:
/**
* setter for name
*/
void setName( std::string name );
void setName( QString name );
/**
* setter for min value
......@@ -82,10 +82,10 @@ private:
WQtNumberEdit m_edit;
QHBoxLayout m_layout;
std::string m_name;
QString m_name;
signals:
void signalNumberWithName( std::string name, int number );
void signalNumberWithName( QString name, int number );
};
#endif // WQTSLIDERWITHEDIT_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment