Now read this, please : http://www.qtcentre.org/threads/51888-using-function-pointers-and-callback-functions
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Oleg Yarigin" <dral...@yandex.ru> To: interest@qt-project.org Sent: Thursday, December 27, 2012 9:35:33 AM Subject: [Interest] A suggestion about replacing signals, actions and slots Hello, I read http://byuu.org/articles/qt and got a question, why Qt uses slots and signals? That stuff can be safe replaced with function pointers. I am sure, it can give some advantages. For instance, for now we need to use something like this to connect callbacks (actions): connect( <a>, <a`s action>, <b>, <b`s slot> ); then we use moc, Q_OBJECT macro and special "slots:" class section. I hope, this stuff can be better (with a way below we do not need to use moc, qmake and have an overhead in Qt library): Action holder: class QWidget { public: void QObject::* slotFoo ( int, int, void* ); void QObject::* eventClose ( QCloseInfo* ); } QWidget::WidgetNeedsToCallAMethod() { if( slotA ) slotFoo( 12, 15 ); } Slot holder: class OurClass : public QMainWindow { void createAction() { QAction a(); a.slotA = eventClose(); //Instead of connect() function } public: void eventClose ( int a, int b ){ ... } } What do you think about it? If you are agree, I will create a new brunch in Qt repo for making these changes. ------ Oleg. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest