Bonjour à tous
J'ai encore un petit probleme.
Voici mon code:

main.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
#define HE
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QLabel>
#include <QTextEdit>
#include <QtNetwork\QTcpServer>
#include <QtCore\QObject>
#include <QtCore\QString>
#include <QTcpServer>
#include <QTcpSocket>
#include <QSound>
#include "link.h"
 
using namespace std;
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QWidget fenetrep; /**objet parent*/
 
    /**Server et client*/
    QTcpServer serveur;
    QTcpSocket client;
    serveur.listen(QHostAddress::Any,8282);
    /**end*/
 
    /**creation of objects link to the parent */
    QPushButton BoutonSeb("Seb",&fenetrep);
    QPushButton BoutonJer("Jer",&fenetrep);
    QPushButton BoutonThi("Thi",&fenetrep);
    QPushButton BoutonEnvoyer("Envoyer",&fenetrep);
    QPushButton BoutonQuitter("Quitter",&fenetrep);
    QLabel LabelConnection("Label d'info--Programme développé par Seb",&fenetrep);
    QLabel LabelReceive("Label de reception",&fenetrep);
    QTextEdit TextZone(&fenetrep);
    link tra(&TextZone,&LabelConnection,&serveur,&client);
    QSound son("ringin.wav",&fenetrep);
    /**end */
 
    /**Resize*/
    fenetrep.resize(800,600);
    BoutonJer.setGeometry(10, 10,50,30);
    BoutonSeb.setGeometry(375, 10,50,30);
    BoutonThi.setGeometry(740, 10,50,30);
    BoutonEnvoyer.setGeometry(370, 500,75,45);
    BoutonQuitter.setGeometry(370,550,75,45);
    LabelConnection.setGeometry(10,30,775,45);
    LabelReceive.setGeometry(10,60,775,300);
    TextZone.setGeometry(10,450,775,45);
    /**end*/
 
 
 
    /**event*/
        QObject::connect(&BoutonQuitter,SIGNAL(clicked()),&app,SLOT(quit()));
        QObject::connect(&BoutonEnvoyer,SIGNAL(clicked()),&tra,SLOT(appaff()));
        QObject::connect(&BoutonSeb,SIGNAL(clicked()),&tra,SLOT(connectionToSeb()));
        QObject::connect(&BoutonJer,SIGNAL(clicked()),&tra,SLOT(connectionToJer()));
        QObject::connect(&BoutonThi,SIGNAL(clicked()),&tra,SLOT(connectionToThi()));
        QObject::connect(&serveur,SIGNAL(newConnection()),&son,SLOT(play()));
        QObject::connect(&serveur,SIGNAL(newConnection()),&tra,SLOT(acceptClient()));
 
    /**end*/
 
 
    fenetrep.show();
 
    return app.exec();
}
link.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
#ifndef HE
#include <QLabel>
#include <QTextEdit>
#include <QtCore\QObject>
#include <QTcpServer>
#include <QTcpSocket>
#include <QSound>
#endif
 
using namespace std;
class link : public QObject
{
    Q_OBJECT
 
 
    public:
    link(QTextEdit *T, QLabel *L,QTcpServer *S,QTcpSocket *C ) : Text(T),Label(L),Serveur(S),Client(C)
     {
     };
 
    void affichage();
 
 
 
 
 
 
    public slots:
    void appaff();
    void connectionToJer();
    void connectionToSeb();
    void connectionToThi();
    void acceptClient();
 
 
 
 
    private:
    QTextEdit *Text;
    QLabel *Label;
    QTcpServer *Serveur;
    QTcpSocket *Client;
 
};
link.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
#include "link.h"
 
void link::appaff()
{
    affichage();
}
 
 
void link::affichage()
{
    Label->setText(Text->toPlainText());
}
 
void link::connectionToJer()
{
    QSound son0("chimes.wav");
    son0.play("chimes.wav");
    Client->connectToHost("192.168.1.251",8282);
}
 
void link::connectionToSeb()
{
    QSound son0("chimes.wav");
    son0.play("chimes.wav");
    Client->connectToHost("192.168.1.254",8282);
}
 
void link::connectionToThi()
{
    QSound son0("chimes.wav");
    son0.play("chimes.wav");
    Client->connectToHost("192.168.1.252",8282);
}
 
void link::acceptClient()
{
    QTcpSocket &socket=Client;
    socket=Serveur->nextPendingConnection();
}
Dans link.cpp, ligne suivante bug à la compilation mais je ne comprend pas pourquoi:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
socket=Serveur->nextPendingConnection();
Pouvez vous m'aidez pour ce petit probleme?
merci d'avance