> As it is, Qt adds some new keywords to C++ (`slot` and `signal` for example), which get replaced by macros by moc, which in turn get replaced by function calls by the preprocessor.
Nothing is 'replaced by moc', moc only generates a source file with meta-object code, and doesn't do any replacements in hand-written code. 'signals', 'slots' and 'emit' are simply _empty_ preprocessor macros (also available as Q_SIGNALS, Q_SLOTS, Q_EMIT), some of them used as markers by moc.
> signal.connect(sigc::bind(sigc::mem_fun(object, &Klass:func), closure));
Where does this ugliness come from? The documentation provides this example:
connect(lineEdit, &QLineEdit::textChanged, label, &QLabel::setText);
Which is so much easier and safer than GObject's version.
The example you provided looks like some ancient Boost.Signal invocation, which could look much better:
signal.connect(boost::bind(&Class:Function, instance, boundValue, _1)); // No C++11 needed!
But it has nothing to do with Qt.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds