Hello!
I am new to Qt, my question may seem simple, but I searched all over the Internet and didn't find the right answer.
I have a QThread class:
#include "thread.h"
{
}
void Thread::run(string url)
{
ui
->webView
->setUrl
(QUrl(url.
c_str()));
connect(ui->webView, SIGNAL(loadFinished(bool)), SLOT(onLoadFinished(bool)));
connect(ui->webView, SIGNAL(loadProgress(int)), SLOT(onLoadProgress(int)));
//connect(pd, SIGNAL(canceled()), this, SLOT(cancel()));
exec();
}
#include "thread.h"
Thread::Thread(QObject *parent)
: QThread(parent)
{
}
void Thread::run(string url)
{
ui->webView->setUrl(QUrl(url.c_str()));
connect(ui->webView, SIGNAL(loadFinished(bool)), SLOT(onLoadFinished(bool)));
connect(ui->webView, SIGNAL(loadProgress(int)), SLOT(onLoadProgress(int)));
//connect(pd, SIGNAL(canceled()), this, SLOT(cancel()));
exec();
}
To copy to clipboard, switch view to plain text mode
Of course, this code doesn't work because I can't access ui from my main class.
So the question is: How can I access the widgets in my main class from this class?
Bookmarks