Hi,
I post here the code where I construct the slider:
{
slider->setSingleStep(1);
slider->setPageStep(1);
slider->setTickPosition(QSlidet::TicksRight);
return slider;
}
QSlider *Window::createSlider()
{
QSlider *slider = new QSlider(0, 10, 1, 5 ); //5 = initial value
slider->setSingleStep(1);
slider->setPageStep(1);
slider->setTickPosition(QSlidet::TicksRight);
return slider;
}
To copy to clipboard, switch view to plain text mode
And here I call the createSlider() routine:
Window::Window()
{
cout << "Window::Window : window object created." << endl;
coinWidget = new CoinWidget; // the coin3d viewer
volumeSlider = createSlider(); //here I construct the slider
openAudioFileButton = createButton();
connect(volumeSlider, SIGNAL(valueChanged(int)), coinWidget, SLOT(setAudioTrackVolume(int)));
connect(openAudioFileButton, SIGNAL(released()), coinWidget, SLOT(openAudioTrack()));
mainLayout->addWidget(coinWidget);
mainLayout->addSpacing( 10 );
mainLayout->addWidget(volumeSlider);
mainLayout->addSpacing( 30 );
mainLayout->addWidget(openAudioFileButton);
mainLayout->addSpacing( 30 );
setLayout(mainLayout);
setWindowTitle(tr("Sound Test Environment"));
}
Window::Window()
{
cout << "Window::Window : window object created." << endl;
coinWidget = new CoinWidget; // the coin3d viewer
volumeSlider = createSlider(); //here I construct the slider
openAudioFileButton = createButton();
connect(volumeSlider, SIGNAL(valueChanged(int)), coinWidget, SLOT(setAudioTrackVolume(int)));
connect(openAudioFileButton, SIGNAL(released()), coinWidget, SLOT(openAudioTrack()));
QHBoxLayout *mainLayout = new QHBoxLayout( this );
mainLayout->addWidget(coinWidget);
mainLayout->addSpacing( 10 );
mainLayout->addWidget(volumeSlider);
mainLayout->addSpacing( 30 );
mainLayout->addWidget(openAudioFileButton);
mainLayout->addSpacing( 30 );
setLayout(mainLayout);
setWindowTitle(tr("Sound Test Environment"));
}
To copy to clipboard, switch view to plain text mode
That's all.
I'm sure there is some errors in my code but I can't find it.
I have an other question:
Is possible to create a slider with smoth movement? I hope you can understand what I mean because my english's not perfect.
Regards,
Franco
Bookmarks