LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-17-2014, 05:41 PM   #1
sharky
Member
 
Registered: Oct 2002
Posts: 569

Rep: Reputation: 84
Cannot change cursor on QListWidget


While running Qprocess I want to display a WaitCursor over a QListWidget. I use the following code.

Code:
def StartProc(self):
  self.lstWidget.viewport().setCursor(QtCore.Qt.WaitCursor)
  self.lstWidget.setDisabled(True)
  self.runner.finished.connect(self.FinProc)
  self.runner.start(some_cmd)

def FinProc(self):
  self.lstWidget.setDisabled(False)
  self.lstWidget.viewport().setCursor(QtCore.Qt.ArrowCursor)
With the above code I see lstWidget get disabled while 'some_cmd' is running but I never see the cursor change. When 'some_cmd' is finished I see lstWidget re-enabled.

Commenting out the last line of the FinProc function causes the cursor to get switched to a WaitCursor after some_cmd is finished. That is completely unexpected and weird.

Identical code works perfectly on a QTextEdit. Not sure why it doesn't work with QListWidget but I am open to suggestions.
 
Old 09-17-2014, 06:02 PM   #2
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Found the solution. I need to update the widget.

Code:
def StartProc(self):
  self.lstWidget.viewport().setCursor(QtCore.Qt.WaitCursor)
  self.lstWidget.update()
  self.lstWidget.setDisabled(True)
  self.runner.finished.connect(self.FinProc)
  self.runner.start(some_cmd)
The update must occur before setDisabled.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] remove a row from QListWidget() devilboy09 Programming 4 07-06-2012 09:22 AM
Hide mouse cursor/change cursor location? mrjamin Linux - Software 4 09-27-2010 10:09 AM
change cursor in fluxbox? lilili Linux - Newbie 1 05-24-2008 09:35 PM
how can i change my mouse cursor? alexii86 Linux - Newbie 2 10-16-2003 01:58 AM
Change a cursor Kroenecker Linux - Newbie 1 08-22-2003 12:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration