Hi to forum member,
I'm really new to Qt C++ programming and need help on constructing a very basic concepts.
So here is my objectives:
I create a Qt GUI application consists of several widgets among them are simple QPushButton and QTextEdit widget. So the idea is, when I press the button I'll start updating the QTextEdit text using setText(). However, I need to delegate this process to separated threads/process/events (what is the best approach?) that will respond (start/stop) on the push button click signal.
Below is my code that I needed help to complete it:
void MyUI::ViewData(){ //this is a slot that is called upon clicked() signal on the pushButton
if(ui->pushButtonView->text() == "Start") {
ui->pushButtonView->setText("Stop");
//how to delegate starting update in this part ... ?
} else if (ui->pushButtonView->text() == "Stop") {
ui->pushButtonView->setText("Start");
//how to delegate stoping update in this part ... ?
ui->dataDisplay->setText("");
}
}
void MyUI::ViewData(){ //this is a slot that is called upon clicked() signal on the pushButton
QString rawdata = "";
if(ui->pushButtonView->text() == "Start") {
ui->pushButtonView->setText("Stop");
//how to delegate starting update in this part ... ?
} else if (ui->pushButtonView->text() == "Stop") {
ui->pushButtonView->setText("Start");
//how to delegate stoping update in this part ... ?
ui->dataDisplay->setText("");
}
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks