PDA

View Full Version : How to change the text of QLineEdit while QTableWidget is being updating with data?



Warlockk
29th May 2017, 11:49
I'm creating a Qt application in which there is a QTableWidget and a QLineEdit. The QTableWidget is updated by a thread with lots of data and it takes time.While the QTableWidget is being updated QLineEdit becomes disable, unfortunately. Means user cannot change the text in QLineEdit until the QTableWidgit is updated. So, my question is that, is there a way with which user can change the text while the QTableWidget is being updated.

Santosh Reddy
30th May 2017, 08:12
Where is QLineEdit placed ?

wysota
1st June 2017, 23:53
First of all you cannot update QTableWidget with a thread. If you want threading then use QTableView and a custom model that will receive data in the worker thread and pass it to the GUI thread through a signal.

If QLineEdit becomes "disabled" when the widget is updated then most likely it is not updated from within the thread but rather by the GUI thread.

You can read this paper to learn about some approaches to do it without threads: https://doc.qt.io/archives/qq/qq27-responsive-guis.html