Qt progress bar not updating

For clarity and ease of use I would use the new style signal and slots.

Qt4/new_style_signals_class progress Thread(QThread): progress_update = Qt Core.

I have also used update() on progress bar but still it is not getting updated.

Kindly let me know what can be done to resolve this.

QProgress Bar has some public slots that are used for setting min and max values and current value.

Increasing the current value causes the progress bar to move.

QProgress Bar(Dialog) self.progress Geometry(Qt Core. QRect(20, 10, 361, 23)) self.progress Property("value", 24) self.progress Object Name("progress Bar") Button = Qt Widgets. QRect(20, 40, 361, 61)) Object Name("push Button") self.retranslate Ui(Dialog) Qt Core.That function is not running in a separate thread it is running on the main event loop and the main event loop waits to run until you exit that function.Update progress sleeps for 1 second and keeps looping.Here is my code below; class dump Thread(QThread): def __init__(self): QThread.__init__(self) def __del__(self): self.wait() def send Establisment Commands(self, connection): # Commands are sending sequently with proper delay-timers # Shell("telnet localhost 21000") time.sleep(0.5) Shell("admin") time.sleep(0.5) Shell("admin") time.sleep(0.5) Shell("cd imdb") time.sleep(0.5) Shell("dump subscriber") command = input('$ ') def run(self): # your logic here # self.emit(Qt Core.SIGNAL('THREAD_VALUE'), max Val) Establisment Commands(connection) class progress Thread(QThread): def __init__(self): QThread.__init__(self) def __del__(self): self.wait() def run(self): # your logic here while 1: max Val = 100 self.emit(SIGNAL('PROGRESS'), max Val) class Main(Qt Gui. QMain Window.__init__(self) = Ui_Main Window() setup Ui(self) connect Button.clicked.connect(self.connect To SESM) def connect To SESM(self): ## Function called when pressing connect button, input are being taken from edit boxes. QApplication(sys.argv) main = Main() main.show() sys.exit(app.exec_()) There are really two problems.

Leave a Reply