У меня есть подкласс QTcpServer :
.h-файл:
#ifndef GEOLISTENER_H
#define GEOLISTENER_H
#include <QTcpServer>
class GeoListener : public QTcpServer
{
Q_OBJECT
public:
explicit GeoListener(QObject *parent = 0);
bool listen(void);
signals:
public slots:
void handleConnection(void);
};
#endif // GEOLISTENER_H
.cpp-файл:
#include "geolistener.h"
#include <QDebug>
GeoListener::GeoListener(QObject *parent) :
QTcpServer(parent)
{
QObject::connect(this, SIGNAL(newConnection()),this, SLOT(handleConnection()));
}
bool GeoListener::listen(void)
{
bool ret;
ret = this->listen(QHostAddress::Any, 9871); //This function isn't found!
/* If something is to be done right after listen starts */
return ret;
}
void GeoListener::handleConnection(void) {
qDebug() << "got connection";
}
Базовый класс Qt-Framework имеет эту функцию:
bool QTcpServer::listen ( const QHostAddress & address = QHostAddress::Any, quint16 port = 0 )
Я перегружал его функцией listen ().Если я сделаю это, я не смогу вызвать функцию выше - по моему мнению, это должно работать.Почему это не работает?Есть идеи?