コード例 #1
0
ファイル: mywidget.cpp プロジェクト: navyzhou926/qt-test
void MyWidget::slotConnect()
{
    socket = server->nextPendingConnection();
    connect(socket, SIGNAL(readyRead()), this, SLOT(slotReadReady()));

    qDebug() << "Client connected";
}
コード例 #2
0
ICQClientSocket::ICQClientSocket(QSocket *s)
#endif
{
    sock = s;
    if (sock == NULL)
#ifdef HAVE_KEXTSOCK_H
        sock = new KExtendedSocket;
    sock->setSocketFlags(KExtendedSocket::outputBufferedSocket );
#else
        sock = new QSocket(this);
    bConnected = false;
#endif
#ifdef HAVE_KEXTSOCK_H
    QObject::connect(sock, SIGNAL(connectionSuccess()), this, SLOT(slotConnected()));
    QObject::connect(sock, SIGNAL(lookupFinished(int)), this, SLOT(slotLookupFinished(int)));
    QObject::connect(sock, SIGNAL(connectionFailed(int)), this, SLOT(slotError(int)));
    QObject::connect(sock, SIGNAL(closed(int)), this, SLOT(slotError(int)));
#else
    QObject::connect(sock, SIGNAL(connected()), this, SLOT(slotConnected()));
    QObject::connect(sock, SIGNAL(connectionClosed()), this, SLOT(slotConnectionClosed()));
    QObject::connect(sock, SIGNAL(error(int)), this, SLOT(slotError(int)));
#endif
    QObject::connect(sock, SIGNAL(readyRead()), this, SLOT(slotReadReady()));
    QObject::connect(sock, SIGNAL(bytesWritten(int)), this, SLOT(slotBytesWritten(int)));
    bInWrite = false;
#ifdef HAVE_KEXTSOCK_H
    if (s) sock->enableRead(true);
#endif
}
コード例 #3
0
SIMClientSocket::SIMClientSocket(QSocket *s)
{
    sock = s;
    if (sock == NULL)
        sock = new QSocket(this);
    QObject::connect(sock, SIGNAL(connected()), this, SLOT(slotConnected()));
    QObject::connect(sock, SIGNAL(connectionClosed()), this, SLOT(slotConnectionClosed()));
    QObject::connect(sock, SIGNAL(error(int)), this, SLOT(slotError(int)));
    QObject::connect(sock, SIGNAL(readyRead()), this, SLOT(slotReadReady()));
    QObject::connect(sock, SIGNAL(bytesWritten(int)), this, SLOT(slotBytesWritten(int)));
    bInWrite = false;
}
コード例 #4
0
ファイル: moc_mywidget.cpp プロジェクト: jiesse/Ad-Machine
int MyWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotConnect(); break;
        case 1: slotReadReady(); break;
        case 2: slotSendMessage(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
コード例 #5
0
ファイル: server.cpp プロジェクト: saibi/test
void Server::slotConnected()
{
    qDebug("[Server::slotConnected()]");

    if ( m_socket )
    {
        m_socket->disconnectFromServer();
        m_socket = 0;
    }

    m_socket = m_server->nextPendingConnection();

    if ( m_socket )
    {
        connect(m_socket, SIGNAL(readyRead()), this, SLOT(slotReadReady()));
        connect(m_socket, SIGNAL(disconnected()), this, SLOT(deleteLater()));

        qDebug("[Server::slotConnected()] next socket");
    }
}