Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PySide: A Little Help
Forum Updated to NodeBB v4.3 + New Features

PySide: A Little Help

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LHBr
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      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.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        LHBr
        wrote on last edited by
        #3

        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.atualizarCompilador()
        self.vetorStatus[self.ui.tabWidget.currentIndex()]['foiModificado'] = True@

        I want to use "self.atualizarCompilador()" just after 5 seconds, for example.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          renato.filho
          wrote on last edited by
          #4

          you can use the timeEvent for that, every object has the a timer inside of himself check for QObject::startTimer().

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mlong
            wrote on last edited by
            #5

            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.

            Software Engineer
            My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved