QThread and Error Access violation
-
You can't call a function from another class.
Also, you have a signature mismatch between your header and implementation.
What exactly are you trying to achieve ?
-
[quote author="SGaist" date="1407412316"]You can't call a function from another class.
Also, you have a signature mismatch between your header and implementation.
What exactly are you trying to achieve ?
[/quote]Where is my mismatch can u show me?
I want to change my tabWidget status from disable to enable after Thread processing... -
@
namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECTpublic:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public:
void _send(QString _title, QString _message); << here
}; @@
void MyThread::run()
{
//Run my function
_send(); << there
}
@ -
[quote author="SGaist" date="1407442699"]@
namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECTpublic:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public:
void _send(QString _title, QString _message); << here
}; @@
void MyThread::run()
{
//Run my function
_send(); << there
}
@[/quote]
Hi again...
I Chaged to
@
public:
void _send();
@and
@
void MainWindow::_send(){
ui->tabWidget->setDisabled(false);
};
@and
@
void MyThread::run()
{
//Run my function
//MainWindow::_send();MainWindow *II; II->_send();
}
@but not working !
Error :@
QObject::connect: No such slot MainWindow::_send() in ..\untitled15\mainwindow.cpp:40
QObject::connect: (receiver name: 'MainWindow')
@ -
[quote author="msue" date="1407481533"]try to change "public" into "public slots" before your send function.[/quote]
Unfortunately ...
The program has unexpectedly finished.
..\untitled15.exe crashed:(
-
That's normal, MainWindow *ll is uninitialized.
Anyway, you should not access MainWindow from your thread, just emit the signal you connected earlier.
Also it's seems you are new to C++, I'd recommend getting a good book about it
-
[quote author="SGaist" date="1407483129"]That's normal, MainWindow *ll is uninitialized.
Anyway, you should not access MainWindow from your thread, just emit the signal you connected earlier.
Also it's seems you are new to C++, I'd recommend getting a good book about it[/quote]
Can you show me a good document or book about this question ?!
I mean how to update GUI in Thread process.Thank you.
-
Qt's own documentation and examples e.g. the Mandelbrot example
-
[quote author="SGaist" date="1407484062"]Qt's own documentation and examples e.g. the Mandelbrot example[/quote]
Thank you for your helping... i try to read it :)