PDA

View Full Version : Change Cursor view and Stop User actions on doing long process



sai_3289
6th March 2013, 09:14
Hi,
I have screen which holds many widgets like line-edit's and combo-box in it and takes the input values from the user,after filling the screen at bottom i have a push-button by clicking on this the respective slot gets activated.In that slot i am posting all the filled details to web service using QnetworkAccessManger and reading the response successfully.But my problem is while posting the data to service and reading the response from service takes some time,during this time i want the cursor to go in wait symbol and user actions on gui should be blocked/stopped .I already tried with the below commands which are
1) setCursor(Qt::WaitCursor);
postingtoServiceMethod();
QCoreApplication::processEvents(); // QApplication::processEvents();
setCursor(Qt::ArrowCursor);

2) QApplication::setOverrideCursor(QCursor(Qt::WaitCu rsor));
postingtoServiceMethod();
QApplication::restoreOverrideCursor();

By following above two methods never in my application the cursor goes into wait symbol stage nor gui gets blocked..?The main thing i need is on the first click of that button the gui should be blocked or should not take any user actions i.e there shouldn't be access to any mouse movement....

Anenja
7th March 2013, 11:10
Hi,

can´t u just use a Modal-QDIALOG with a progressbar -> dont allow closing qdialog until ur Taks is finished -> when task finished, just close the dialog...
No user input can be made during the dialog is executed (dlg.exec()) -> modal to app or parent whatever u want...

Just an idea....

greets

wysota
7th March 2013, 11:20
Set the enabled property of your UI window to false. When you receive response or a timeout occurs, set it back to true.

sai_3289
8th March 2013, 04:51
@Anenja : Thanks for the idea....
@wysota :thanks a lot....it has been worked....Is their any book or pdf available which covers most of qt concepts???

wysota
8th March 2013, 09:36
Is their any book or pdf available which covers most of qt concepts???

For Qt4 I find Foundations of Qt Development by Johan Thelin the best and Qt GUI Programming with Qt4 is also fine. For Qt5 I don't think any books that cover Qt in depth have been released yet.