I have this class
#include <QTcpSocket>
#include <QTextBrowser>
#include "clientthread.h"
ClientThread::ClientThread(int socketDescriptor)
{
_socketDescriptor = socketDescriptor;
setWindowTitle("Server version 0.9 beta");
setCentralWidget(textBrowser);
setFixedSize(400,400);
show();
run();
}
void ClientThread::run()
{
if(!tcpSocket->setSocketDescriptor(_socketDescriptor))
textBrowser->append("Error in the connection");
else
textBrowser->append("Client successfully connected");
iniConnection();
exec();
}
void ClientThread::iniConnection()
{
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
}
void ClientThread::readData()
{
}
#include <QTcpSocket>
#include <QTextBrowser>
#include "clientthread.h"
ClientThread::ClientThread(int socketDescriptor)
{
_socketDescriptor = socketDescriptor;
textBrowser = new QTextBrowser(this);
setWindowTitle("Server version 0.9 beta");
setCentralWidget(textBrowser);
setFixedSize(400,400);
show();
run();
}
void ClientThread::run()
{
tcpSocket = new QTcpSocket();
if(!tcpSocket->setSocketDescriptor(_socketDescriptor))
textBrowser->append("Error in the connection");
else
textBrowser->append("Client successfully connected");
iniConnection();
exec();
}
void ClientThread::iniConnection()
{
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
}
void ClientThread::readData()
{
}
To copy to clipboard, switch view to plain text mode
When i try to compile it, I get this error:
clientthread.cpp:33: error: `QObject' is an ambiguous base of `ClientThread'
I know the error can be disabled in this lines
void ClientThread::iniConnection()
{
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
}
void ClientThread::iniConnection()
{
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
}
To copy to clipboard, switch view to plain text mode
The "connect" is the problem
What is wrong ?
Bookmarks