Hi!
I want to manage several dynamically created QSliders in a QVector.
So we are talking of
{
Q_OBJECT
public:
MyWidget();
~MyWidget();
private:
QVector<QSlider> m_sliders;
}
class MyWidget : public QWidget
{
Q_OBJECT
public:
MyWidget();
~MyWidget();
private:
QVector<QSlider> m_sliders;
}
To copy to clipboard, switch view to plain text mode
First (general) Question:
Where are the elements of a vector really stored? On the stack or on the heap?
Second question:
I can create sliders via eg.
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);
}
}
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);
}
}
To copy to clipboard, switch view to plain text mode
But how can I remove them???
Thanks for your hints in advance,
regards
Bookmarks