#include <QThread>#include <QMessageBox>class threadWeather : public QThread{ Q_OBJECTpublic: threadWeather(QObject *parent = 0); ~threadWeather(); void run();};
#include "threads.h"threadWeather::threadWeather(QObject *parent) : QThread(parent){}threadWeather::~threadWeather(){}void threadWeather::run(){ QMessageBox::information(0, "title", inf_stat); exec();}
threadWeather::threadWeather(CIForm *f, QObject *parent) : QThread(parent), frm(f) {}
void threadWeather::run(){ QString str = frm->state(); <do_some_thing_with_state> ...}
class threadWeather : public QThread{ Q_OBJECTpublic: threadWeather(QObject *parent = 0); ~threadWeather();private slots: void run(); void http_weather_state();private: //QHttps QHttp *http_weather; //Buffers QBuffer buffer_weather;};
threadWeather::threadWeather(QObject *parent) : QThread(parent){}threadWeather::~threadWeather(){}void threadWeather::run(){ http_weather = new QHttp(this); connect(http_weather, SIGNAL(stateChanged(int)), this, SLOT(http_weather_state())); exec();}void threadWeather::http_weather_state(){ if (http_weather->state() == 5) { http_weather->closeConnection(); buffer_weather.close(); QMessageBox::information(0, "weather", QString(buffer_weather.buffer())); }}