Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
PySide: A Little Help
LHBr last edited by
Hello everyone. I need a little help with a PySide Application. I already searched for a solution, but i didn't find... So, I decided to ask for help.
Here is my problem: I have a QTextEdit and i want to do "some stuff" JUST after keyboard is IDLE for a certain time. For example:
Text is changed
Keyboard is idle for 5 seconds
Print "Hello World!"
I will appreciate any kind of help... BTW, sorry for my english, I'm brazilian =P
Not sure of the specifics of PySide, but in general you could use a keypress event to reset a QTimer back to 0, and then if the QTimer is allowed to expire (because a keypress hasn't occurred) then it would call a slot which allows "some stuff" to run.
LHBr last edited by
Thank you for your reply. It could work, but I can't use QTimer. I need to do this without a QTimer cuz my boss asked me that.
Anyway, here is my method (textChanged() is called every time a text is changed on my QTextEdit):
def textChanged (self):
self.vetorStatus[self.ui.tabWidget.currentIndex()]['foiModificado'] = True@
I want to use "self.atualizarCompilador()" just after 5 seconds, for example.
renato.filho last edited by
you can use the timeEvent for that, every object has the a timer inside of himself check for QObject::startTimer().
bq. every object has the a timer inside of himself check for QObject::startTimer()
Holy cow! That is embarrassingly shocking. I hate to admit it, but I've been using Qt for about 13 or 14 years now and somehow I've managed to completely miss the existence of that functionality in QObject. (Either that or I'm starting to forget the details of stuff I might have once known but then never used.) Looks like it's been there forever too (it was there in the 2.x docs I have.) Makes me wonder what other stuff I don't know (or have forgotten -- I like that scenario better :-) ). Yikes!
Anyway, that does look like a nice viable solution, too. Same setup without the external QTimer.