Skip to content

Qt Jambi – Updating UI elements from another thread

Generally using Signal slots seem to be the best approach, but for quick and dirty way to just update something on the UI, we can use QApplication.invokeLater and invokeAndWait methods. An example code snippet is below.

QApplication.invokeAndWait(new Runnable() {
    public void run() {
        QTableWidgetItem item = new QTableWidgetItem("hello");
        ui.tblStats.setItem(0,1, item);

Posted in Java, Qt. Tagged with , , , , , .