I need to realize several buttons (as well as Qlabels, QtextEdit) in QWidget.
But I need to do it non-lockable, so if it is executinh a long time, it should be not hanging.
In java it works very fine with SwingWorker class, but not with Runnable.
So I need to know what analog I need to use in Qt.
Here is excerpts from java code. As it is very compact so I need to follow it in Qt but with local
classes:
class Writefile extends SwingWorker {//Declaration of custom thread class
public Object doInBackground() {
XMLCreator.stax();//class and method that realize XML writing to file.
return null;
}
writetofile.addActionListener(new ActionListener() { //adding listener to button
public void actionPerformed(ActionEvent e) {
//XMLCreator.stax();
Writefile process = new Writefile(); //initizalization of swingworjer class
process.execute(); //starting separate task in separate thread
}
});
class Writefile extends SwingWorker {//Declaration of custom thread class
public Object doInBackground() {
XMLCreator.stax();//class and method that realize XML writing to file.
return null;
}
writetofile.addActionListener(new ActionListener() { //adding listener to button
public void actionPerformed(ActionEvent e) {
//XMLCreator.stax();
Writefile process = new Writefile(); //initizalization of swingworjer class
process.execute(); //starting separate task in separate thread
}
});
To copy to clipboard, switch view to plain text mode
So how should I use
Qtobject::connect(writebutton,SIGNAL(clicked()), this, SLOT(Filewalker::writetofile()));
Qtobject::connect(writebutton,SIGNAL(clicked()), this, SLOT(Filewalker::writetofile()));
To copy to clipboard, switch view to plain text mode
//The last is the slot declared in Filewalker class header
Bookmarks