well, i certainly must have done something improper since the whole thing doesn't want to compile. the problem is that i have no idea where exactly my fault may be.
main.cpp:
#include <qapplication.h>
#include "guiclient.h"
#include "mainwindow.h"
int main(int argc,char **argv){
guiClient *socket=new guiClient("127.0.0.1",13000);
mainWindow *mainWin=new mainWindow(0,0,socket);
loko.setMainWidget(mainWin);
mainWin->show();
return loko.exec();
}
#include <qapplication.h>
#include "guiclient.h"
#include "mainwindow.h"
int main(int argc,char **argv){
guiClient *socket=new guiClient("127.0.0.1",13000);
QApplication loko(argc,argv);
mainWindow *mainWin=new mainWindow(0,0,socket);
loko.setMainWidget(mainWin);
mainWin->show();
return loko.exec();
}
To copy to clipboard, switch view to plain text mode
guiclient.h:
#ifndef GUICLIENT_H
#define GUICLIENT_H
#include <qsocket.h>
class guiClient:public QSocket{
public:
guiClient
(const QString &host,Q_UINT16 port
);
};
guiClient
::guiClient(const QString &host,Q_UINT16 port
):QSocket
(){ connectToHost(host,port);
}
void guiClient
::socketSend(QString question
){ os << question << "|"; //"|" required for cooperation with the server (no "readline" in .net)
}
#endif
#ifndef GUICLIENT_H
#define GUICLIENT_H
#include <qsocket.h>
class guiClient:public QSocket{
public:
guiClient(const QString &host,Q_UINT16 port);
void socketSend(QString question);
};
guiClient::guiClient(const QString &host,Q_UINT16 port):QSocket(){
connectToHost(host,port);
}
void guiClient::socketSend(QString question){
QTextStream os(this);
os << question << "|"; //"|" required for cooperation with the server (no "readline" in .net)
}
#endif
To copy to clipboard, switch view to plain text mode
mainwindow.h:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
class guiClient;
Q_OBJECT
public:
mainWindow
(QWidget *parent
=0,
char *name
=0,guiClient
*sock
=0);
private:
guiClient *s;
};
mainWindow
::mainWindow(QWidget *parent,
char *name,guiClient
*sock
):QMainWindow(parent,name
){ sock->socketSend("test");
}
#endif
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
class guiClient;
class mainWindow:public QMainWindow{
Q_OBJECT
public:
mainWindow(QWidget *parent=0,char *name=0,guiClient *sock=0);
private:
guiClient *s;
};
mainWindow::mainWindow(QWidget *parent,char *name,guiClient *sock):QMainWindow(parent,name){
sock->socketSend("test");
}
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks