Hi!
I have:
{
Q_OBJECT
public:
MyWidget();
~MyWidget();
public slots:
void adequate_function(int slider_id, int value);
private:
QVector<QSlider*> m_sliders;
}
class MyWidget : public QWidget
{
Q_OBJECT
public:
MyWidget();
~MyWidget();
public slots:
void adequate_function(int slider_id, int value);
private:
QVector<QSlider*> m_sliders;
}
To copy to clipboard, switch view to plain text mode
and my constructor looks like
MyWidget::MyWidget()
{
for (int i=0 ; i<5 ; i++)
{
m_sliders.
append(QSlider(Qt
::Horizontal,
this));
m_sliders[i].setRange(0,100);
m_sliders[i].setPageStep(20);
//this does not work but explains what I like
QObject::connect( m_sliders
[i
],
SIGNAL(valueChanged
(int)),
this, SLOT(setDeformationFactor( i , int) ) );
}
}
MyWidget::MyWidget()
{
for (int i=0 ; i<5 ; i++)
{
m_sliders.append(QSlider(Qt::Horizontal, this));
m_sliders[i].setRange(0,100);
m_sliders[i].setPageStep(20);
//this does not work but explains what I like
QObject::connect( m_sliders[i], SIGNAL(valueChanged(int)),
this, SLOT(setDeformationFactor( i , int) ) );
}
}
To copy to clipboard, switch view to plain text mode
so, I would like to call a function and give the slider id as argument.
Regards,Olli
Bookmarks