can you explain me what is slot ... i read this thing from tutorial .. but i am not very clear how to connect with slot ..
Added after 54 minutes:
I tried to add slot in my code .. but it is still not working .. please point out my mistake in my code ...
package com.trolltech.qt.webkit;
import sun.awt.RequestFocusController;
import sun.security.pkcs.ParsingException;
import com.trolltech.qt.QtEnumerator;
import com.trolltech.qt.QSignalEmitter.Signal1;
import com.
trolltech.
qt.
core.
QObject;
import com.
trolltech.
qt.
core.
QUrl;
import com.
trolltech.
qt.
core.
QUrl.
ParsingMode;
import com.
trolltech.
qt.
network.
QHttp;
import com.trolltech.qt.network.QNetworkAccessManager;
import com.trolltech.qt.network.QNetworkReply;
import com.trolltech.qt.network.QNetworkRequest;
public class test {
private int httpGetId;
private boolean httpRequestAborted;
public test(){
String url = "http://www.msn.com/st?=1";
System.out.println(qURL.encodedHost());
header.setValue("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)");
header.setValue("Pragma", "no-cache");
header.setValue("Host","miniorb.in" );
qHttp.setHost("minirob.in");
qHttp.request(header);
httpGetId = qHttp.get(qURL.path());
qHttp.requestFinished.connect(this, "httpRequestFinished(int,boolean)");
qHttp.responseHeaderReceived.connect(this,"readResponseHeader(QHttpResponseHeader)");
System.out.println("xyz : " + xyz.size());
System.out.println("print 1: " + qHttp.request(header));
String str = "Divanshu On work";
System.out.println("inside the finsihed()" + str);
}
private void httpRequestFinished(int requestId, boolean error)
{
System.out.println("httpRequestFinished");
if (requestId != httpGetId){
System.out.println("Error");
return;
}
}
{
if (responseHeader.statusCode() != 200) {
httpRequestAborted = true;
qHttp.abort();
}
}
public static void main(String args[]){
test window = new test();
}
}
package com.trolltech.qt.webkit;
import sun.awt.RequestFocusController;
import sun.security.pkcs.ParsingException;
import com.trolltech.qt.QtEnumerator;
import com.trolltech.qt.QSignalEmitter.Signal1;
import com.trolltech.qt.core.QByteArray;
import com.trolltech.qt.core.QObject;
import com.trolltech.qt.core.QUrl;
import com.trolltech.qt.core.QUrl.ParsingMode;
import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.network.QHttp;
import com.trolltech.qt.network.QHttpRequestHeader;
import com.trolltech.qt.network.QHttpResponseHeader;
import com.trolltech.qt.network.QNetworkAccessManager;
import com.trolltech.qt.network.QNetworkReply;
import com.trolltech.qt.network.QNetworkRequest;
public class test {
private int httpGetId;
private boolean httpRequestAborted;
private QHttp qHttp;
public test(){
String url = "http://www.msn.com/st?=1";
QUrl qURL = new QUrl(url);
System.out.println(qURL.encodedHost());
QHttpRequestHeader header = new QHttpRequestHeader("GET", "/index.html");
header.setValue("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)");
header.setValue("Pragma", "no-cache");
header.setValue("Host","miniorb.in" );
qHttp = new QHttp();
qHttp.setHost("minirob.in");
qHttp.request(header);
httpGetId = qHttp.get(qURL.path());
qHttp.requestFinished.connect(this, "httpRequestFinished(int,boolean)");
qHttp.responseHeaderReceived.connect(this,"readResponseHeader(QHttpResponseHeader)");
QByteArray xyz = qHttp.readAll();
System.out.println("xyz : " + xyz.size());
System.out.println("print 1: " + qHttp.request(header));
String str = "Divanshu On work";
System.out.println("inside the finsihed()" + str);
}
private void httpRequestFinished(int requestId, boolean error)
{
System.out.println("httpRequestFinished");
if (requestId != httpGetId){
System.out.println("Error");
return;
}
}
private void readResponseHeader(QHttpResponseHeader responseHeader)
{
if (responseHeader.statusCode() != 200) {
httpRequestAborted = true;
qHttp.abort();
}
}
public static void main(String args[]){
test window = new test();
}
}
To copy to clipboard, switch view to plain text mode
Thanks in advance !!!
Bookmarks