[Help] With Qt
Main :
*.h
*.cpp
Here is my question :
I want that when i move the slider, the value of the Progress Bar follow the slider.... But I don't find how. Plz HELP
Code:
#include <QApplication>
#include "MaFenetre.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MaFenetre fenetre;
fenetre.show();
return app.exec();
}
Code:
#ifndef MAFENETRE_H_INCLUDED
#define MAFENETRE_H_INCLUDED
#include <QApplication>
#include <QWidget>
#include <QPushButton>
#include <QSlider>
#include <QProgressBar>
class MaFenetre : public QWidget
{
public:
MaFenetre();
private:
QProgressBar *m_bar;
QSlider *m_slider;
};
#endif
Code:
#include "MaFenetre.h"
MaFenetre::MaFenetre() : QWidget()
{
setFixedSize(200, 100);
m_bar = new QProgressBar(this);
m_bar->setGeometry(10, 20, 150, 20);
m_slider = new QSlider(Qt::Horizontal, this);
m_slider->setGeometry(10, 60, 150, 20);
QObject::connect(m_slider, SIGNAL(valueChanged(int)), m_bar, SLOT(display(int)));
QObject::connect(m_bar, SIGNAL(valueChanged(int)), m_slider, SLOT(setValue(int)));
}
I want that when i move the slider, the value of the Progress Bar follow the slider.... But I don't find how. Plz HELP
