What does the Keyword "Q_DECL_OVERRIDE" do? , QThread
-
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);@ -
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 -
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