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. What does the Keyword "Q_DECL_OVERRIDE" do? , QThread
QtWS25 Last Chance

What does the Keyword "Q_DECL_OVERRIDE" do? , QThread

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 21.2k Views
  • 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.
  • W Offline
    W Offline
    Wuzi
    wrote on last edited by
    #1

    Hi,

    I read the part about QThread and I found there the keyword Q_DECL_OVERRIDE. What does this keyword do?

    @ void run() Q_DECL_OVERRIDE {
    QString result;
    /* ... here is the expensive or blocking operation ... */
    emit resultReady(result);
    }@

    I found an other question: Why on this code below there aren't the keywords SIGNAL and SLOTS?
    @connect(workerThread, &WorkerThread::resultReady, this, &MyObject::handleResults);@

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      It is a preprocessor macro that expands to the C++11 keyword "override" if the project is built with the C++11 options on and the compiler supports it, or nothing otherwise. The "override" attribute allows the compiler to tell you when you try to overide a virtual function but get the function signature wrong.
      http://qt-project.org/doc/qt-5/qtglobal.html#Q_DECL_OVERRIDE
      And
      http://woboq.com/blog/cpp11-in-qt5.html

      1 Reply Last reply
      1
      • G Offline
        G Offline
        Gallaecio
        wrote on last edited by
        #3

        You probably already found out but, regarding your second question, it is a new slot and signal syntax which takes advantage of C++11 as well. For details, see http://woboq.com/blog/new-signals-slots-syntax-in-qt5.html

        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