I have found several questions that looks similar to this such as:
But most of the examples and answers were on 1 GUI thread and 1 data processing thread.
Let me explain my scenario.
I have 3 classes:
- class MainWindow (Inherited from
QMainWindow
class and act as main GUI) - class LogInWidget (Inherited from
QWidget
class.This class consists of all the username/password field + a progress bar, pls see the image below)
3.class DataTableWidget (Inherited from QWidget
class.consist of a table that display a few hundreds thousands of data)
The program is designed so that once a user logged in to the program via LogInWidget
, he will be able to see all the data displayed by the DataTableWidget
.
I use .setCentralWidget
method to set both LogInWidget
and DataTableWidget
.(ie.if the user password is correct, i use
table = DataTableWidget ()
self.setCentralWidget(table)
to display the table.
My problem is: When user logged in, there is a big GUI freeze before he can see the data table as there are so many data entry to display via the table.
So I would like to show a busy progress bar (on my LogInWidget
) before the program finish loading the table.
I thought of using Qthread
to accomplish it but since both tasks, displaying progress bar and creating DataTableWidget
and setting as centralwidget is GUI tasks, how should i approach it?