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. [solved] QTimer in console application
Forum Updated to NodeBB v4.3 + New Features

[solved] QTimer in console application

Scheduled Pinned Locked Moved General and Desktop
20 Posts 4 Posters 13.1k 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.
  • JKSHJ Offline
    JKSHJ Offline
    JKSH
    Moderators
    wrote on last edited by
    #11

    [quote author="hskoglund" date="1423561353"]You don't need any parenthesis when lambda has no arguments, "learned that":http://qt-project.org/forums/viewreply/216748/ from JKSH the other day :-)[/quote]Pay it forward! ;-)

    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

    1 Reply Last reply
    0
    • D Offline
      D Offline
      deleted28
      wrote on last edited by
      #12

      not sure it makes sense to add to an already solved topic (?)

      in above lecture the main reason i did not solve the problem myself
      by trial & error was Chris' hint to use
      @CONFIG += c++11@

      in .pro file.
      It's mentioned here "docs":http://doc.qt.io/qt-5/qmake-variable-reference.html#config
      but this is not really an explanation.
      Where can i find an explanation what this instruction really effects
      and in which cases to use ?

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #13

        [quote author="wally123" date="1423669903"]not sure it makes sense to add to an already solved topic (?)[/quote]That's perfectly ok if you are continuing to discuss the same topic.

        [quote author="wally123" date="1423669903"]in above lecture the main reason i did not solve the problem myself
        by trial & error was Chris' hint to use
        @CONFIG += c++11@

        in .pro file.
        It's mentioned here "docs":http://doc.qt.io/qt-5/qmake-variable-reference.html#config
        but this is not really an explanation.
        Where can i find an explanation what this instruction really effects
        and in which cases to use ?
        [/quote]That instructions tells your compiler to enable "C++11":http://www.cprogramming.com/c++11/what-is-c++0x.html features.

        The QTimer code that Chris posted uses a lambda expression, which was introduced in C++11; that's why you need that command.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deleted28
          wrote on last edited by
          #14

          thx
          needless to say which expression is now in center of interest :)
          λ

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #15

            [quote author="wally123" date="1423671202"]thx
            needless to say which expression is now in center of interest :)
            λ [/quote]You're welcome! It's a very nice toy indeed. Once you learn how to use it, I'm sure you'll be using it lots. ;)

            Lambda expressions make it much easier to write event-driven code in Qt. If your slot is only used in one place, you can define it as a lambda right in the "connect" statement. No need to create a separate function in your class anymore. See "Making Connections to Lambda Expressions":http://doc.qt.io/qt-5/signalsandslots-syntaxes.html#making-connections-to-lambda-expressions.

            Happy coding!

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #16

              The doc pretty much says everything there is to say about it but I'll try to expand.

              As you may or may not know C++ goes through revisions and different compilers have varying support for the latest standard.
              In case of GCC the default is c++03 and to enable the latest c++11 you need a compiler param -std=c++11. To make this portable across compilers qmake exposes this as the above CONFIG switch and does the right thing for the given compiler to enable c++11 support.

              Lambdas (or captures or anonymous functions as they are also known) are new part of c++11 standard.
              "Here":https://gcc.gnu.org/projects/cxx0x.html is a comprehensive table listing all the new features of c++11 and which gcc version supports what.

              Oh, the next revision of c++ has been already voted in last year so expect something like CONFIG+=c++14 available pretty soon.

              As for which c++11/14 features are supported/used by Qt you can travel the net, e.g. "here":http://woboq.com/blog/cpp11-in-qt5.html or "here":http://woboq.com/blog/cpp14-in-qt.html

              1 Reply Last reply
              0
              • D Offline
                D Offline
                deleted28
                wrote on last edited by
                #17

                This forum is really incredible efficient for learning !

                btw.: does anybody pay you for your time and sharing knowhow ?

                1 Reply Last reply
                0
                • Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #18

                  Don't know about others but I pretty much operate on a "beerware":http://en.wikipedia.org/wiki/Beerware based rules.

                  1 Reply Last reply
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #19

                    [quote author="wally123" date="1423672274"]This forum is really incredible efficient for learning ![/quote]It is. :) We hope that one day, when you're a Qt veteran, you'll come back and help newcomers too!

                    [quote author="wally123" date="1423672274"]btw.: does anybody pay you for your time and sharing knowhow ?[/quote]I suppose I get paid in pats-on-the-back, satisfaction, reputation, and knowledge + experience.

                    I often learn new things while doing research to answer a question. In turn, that helps me produce better code, which makes my customers happy, so they keep paying me.

                    BTW, it's not limited to this forum; the hacker community is full of volunteers, e.g. "StackOverflow":http://stackoverflow.com/

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      deleted28
                      wrote on last edited by
                      #20

                      :)

                      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