Results 1 to 5 of 5

Thread: progress bar issues

  1. #1

    Default progress bar issues

    Hi all,

    I'm trying to update a progress bar, but whenever I run setValue it crashes my program. The error I get looks like this:

    X Error: BadRequest (invalid request code or no such operation) 1
    Extension: 183 (Uknown extension)
    Minor opcode: 0 (Unknown request)
    Resource id: 0x36020ba
    It doesn't happen on each iteration, only some initially, but then toward the end of the iteration, each setValue command fails, and then the program crashes.

    X Error: BadRequest (invalid request code or no such operation) 1
    Major opcode: 0 ()
    Resource id: 0x36020ba
    my code looks like this

    Qt Code:
    1. x=0
    2. while x < len(fileList):
    3. # do stuff
    4. self.progressBar.setValue(x)
    5. x+=1
    To copy to clipboard, switch view to plain text mode 

    any advise?
    Last edited by jpn; 13th March 2008 at 06:32. Reason: missing tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: progress bar issues

    Does this happen in the main GUI thread?
    J-P Nurmi

  3. #3

    Default Re: progress bar issues

    I think so.

    I create an instance of a class which inherits QThread, in the initializer of the mainwindow, and store that instance in a variable in the mainwindow class, so the pseudo code would be

    python Code:
    1. class myThread(QThread):
    2. def __init__(self):
    3. QThread.__init__(self)
    4.  
    5. def run(self):
    6. x=0
    7. while x != progBarMax:
    8. progressBar.setValue(x)
    9. x+=1
    10.  
    11. class myInterface(QMainWindow, UIModule.My_UI):
    12. def __init__(self, parent=None):
    13. super(myInterface, self).__init__(parent)
    14. self.setupUI(self)
    15. self.interface = myThread()
    16.  
    17. @pyqtSignature("")
    18. def on_button_clicked(self):
    19. self.interface.start()
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 13th March 2008 at 22:38. Reason: Missing [highlight] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: progress bar issues

    In that case you are accessing a GUI object (progressBar) from within a worker thread which is forbidden. You have to do that from within the GUI thread.

  5. #5

    Default Re: progress bar issues

    Ok. Thanks for the help. It's working now

Similar Threads

  1. busy progress bar without thread ?
    By npc in forum Newbie
    Replies: 34
    Last Post: 23rd July 2009, 09:29
  2. Replies: 4
    Last Post: 11th March 2008, 11:44
  3. how to create sliding progress bar ?
    By npc in forum Newbie
    Replies: 2
    Last Post: 26th March 2007, 17:40
  4. How To Incorporate Progress Bar In Program
    By deekayt in forum Qt Programming
    Replies: 8
    Last Post: 20th December 2006, 14:40
  5. Progress Bar to be shown!!!
    By Kapil in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2006, 09:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.