Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, July 2007
QTcpServer newConnection() signal


Message 1 in thread

Hi There,

I found a rather interesting thing, can someone explain please?

class server : public QTcpServer {
	Q_OBJECT

public:
	server() {
		if (!connect(this, SIGNAL(newConnection()), this,
SLOT(nc()))) {
			printf("connect failed\n");
		}
	}

private slots:
	void nc() {
		printf("newConnection ...\n");
	}
};

int main (int argc, char* argv[]) {
	QCoreApplication app(argc, argv);
	server srv;
	....

	return 0;
}

When this code gets executed, I got the following error message:
QObject::connect: Attempt to bind non-signal server:newConnection()

Hmm, what is wrong here?

Thanks,
Sandor

--
 [ signature omitted ] 

Message 2 in thread

Forget it.... return 0 -> app.exec() and it works...

-----Original Message-----
From: qt-interest-request@xxxxxxxxxxxxx
[mailto:qt-interest-request@xxxxxxxxxxxxx]On Behalf Of Hadas Sandor
Sent: 16/07/2007 12:35
To: 'qt-interest@xxxxxxxxxxxxx'
Subject: QTcpServer newConnection() signal


Hi There,

I found a rather interesting thing, can someone explain please?

class server : public QTcpServer {
	Q_OBJECT

public:
	server() {
		if (!connect(this, SIGNAL(newConnection()), this,
SLOT(nc()))) {
			printf("connect failed\n");
		}
	}

private slots:
	void nc() {
		printf("newConnection ...\n");
	}
};

int main (int argc, char* argv[]) {
	QCoreApplication app(argc, argv);
	server srv;
	....

	return 0;
}

When this code gets executed, I got the following error message:
QObject::connect: Attempt to bind non-signal server:newConnection()

Hmm, what is wrong here?

Thanks,
Sandor

--
 [ signature omitted ] 

Message 3 in thread

Solved ....


Sandor


-----Original Message-----
From: Hadas Sandor 
Sent: 16/07/2007 12:38
To: 'qt-interest@xxxxxxxxxxxxx'
Subject: RE: QTcpServer newConnection() signal


Forget it.... return 0 -> app.exec() and it works...

-----Original Message-----
From: qt-interest-request@xxxxxxxxxxxxx
[mailto:qt-interest-request@xxxxxxxxxxxxx]On Behalf Of Hadas Sandor
Sent: 16/07/2007 12:35
To: 'qt-interest@xxxxxxxxxxxxx'
Subject: QTcpServer newConnection() signal


Hi There,

I found a rather interesting thing, can someone explain please?

class server : public QTcpServer {
	Q_OBJECT

public:
	server() {
		if (!connect(this, SIGNAL(newConnection()), this,
SLOT(nc()))) {
			printf("connect failed\n");
		}
	}

private slots:
	void nc() {
		printf("newConnection ...\n");
	}
};

int main (int argc, char* argv[]) {
	QCoreApplication app(argc, argv);
	server srv;
	....

	return 0;
}

When this code gets executed, I got the following error message:
QObject::connect: Attempt to bind non-signal server:newConnection()

Hmm, what is wrong here?

Thanks,
Sandor

--
 [ signature omitted ]