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. How does the QTimer work?
Forum Updated to NodeBB v4.3 + New Features

How does the QTimer work?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 5 Posters 7.9k 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.
  • M Offline
    M Offline
    mlong
    wrote on last edited by
    #2

    connect is a static method of "QObject,":/doc/qt-4.8/qobject.html and is one of the most important methods in Qt programming, as it is responsible for setting up connections between "Signals and Slots.":/doc/qt-4.8/signalsandslots.html

    It's one of the fundamentals, so you're best to go study "those":/doc/qt-4.8/how-to-learn-qt.html before getting too far into things.

    Good luck!

    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
    • F Offline
      F Offline
      Flurite
      wrote on last edited by
      #3

      bq. connect is a static method of QObject, and is one of the most important methods in Qt programming, as it is responsible for setting up connections between Signals and Slots.
      It’s one of the fundamentals, so you’re best to go study those before getting too far into things.
      Good luck!

      Thanks for the info. I am not too interested in developing anything with Qt, but rather I use the IDE to learn the C++ language. When I created my own timer widget, I realized it got unresponsive, because Qt widget projects unfortunately do not take infinite loops, without using QCoreApplication::processEvents(). I thought learning about QTimer would help, but I realized it was really based off of the Qt framework.

      Is this the case with all the IDEs with widget systems, such as MS Visual Studio and Code::Blocks? Do they all have their own "system"?

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

        Anything with a Q in front of it is going to be Qt-related.

        As for the IDEs and "systems", generally IDEs are designed to work within a certain environment and support extension libraries, and such. However, Qt Creator and MSVS and Eclipse (etc.) can happily be used to develop pure C++ apps. You just have to understand the boundaries of what is native C++ and what is provided by the Toolkits that they tend to want to integrate with.

        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
        • F Offline
          F Offline
          Flurite
          wrote on last edited by
          #5

          Cool, so if I ran a program that uses Q libraries like QString and QRegExp on a computer with none of those libraries, would it work?

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vezprog
            wrote on last edited by
            #6

            If you link the program dynamically to desired Qt libraries...then yes. Aka, if QtCore4.dll is in the same folder as your executable that you are trying to run then it should pick up the libraries.

            Qt is not a standard...you must download the sources or SDK, compile it (static or dynamic), and link to them. As in any library or framework.

            http://qt-project.org/doc/qt-5.0/deployment.html

            1 Reply Last reply
            0
            • F Offline
              F Offline
              Flurite
              wrote on last edited by
              #7

              Darn it. I tried turning my timer into a thread to reduce the lagginess of the widget, but somehow, I cannot include the Ui namespace in the thread..

              @
              void Clock_Application::timer_Start()
              {
              timingThread Timer;
              Timer.start();
              }

              bool timing_Stopwatch = false;
              void timingThread::run()
              {
              using namespace Ui;

              // more code
              }
              

              }
              @

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #8

                Using a thread to run a timer is a Bad Idea(TM). Don't go there, please.

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  veeraps
                  wrote on last edited by
                  #9

                  Hi Andre,

                  Would you please add in some more inputs or a source link - for not using a thread to run a timer?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #10

                    [quote author="veeraps" date="1334824358"]Hi Andre,

                    Would you please add in some more inputs or a source link - for not using a thread to run a timer?[/quote]
                    Sure, "here":/wiki/Threads_Events_QObjects#92dd35cc61ffc41d02defdcef071856d you go.

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      veeraps
                      wrote on last edited by
                      #11

                      Thanks Andre for the information - learnt a new thing today.

                      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