Hi, On Tue, 16 Dec 2014 10:49:53 +0300, Igor Mironchik <igor.mironc...@gmail.com> wrote:
> > I.e. I want to have, for example, next method in my widget: > > Something * addSomething( QObject * receiver, PointerToMemberFunction > method ); > I've answered on the second question by myself. And now I have next code in my ToolBar class: /*! Creates a new action with the given \a icon. This action is added to the end of the toolbar. The action's QAction::triggered() signal is connected to \a method in \a receiver. */ template <typename Func1> inline QAction * addAction( const QIcon & icon, const typename QtPrivate::FunctionPointer<Func1>::Object * receiver, Func1 slot ) { QAction * action = new QAction( icon, QString(), this ); QObject::connect( action, &QAction::triggered, receiver, slot ); addAction( action ); return action; } /*! Creates a new action with the given \a icon. This action is added to the end of the toolbar. The action's QAction::triggered() signal is connected to \a functor. */ template <typename Func1> inline QAction * addAction( const QIcon & icon, Func1 functor ) { QAction * action = new QAction( icon, QString(), this ); QObject::connect( action, &QAction::triggered, functor ); addAction( action ); return action; } And my question is: is it ok to use QtPrivate::FunctionPointer in my classes? -- Best Regards, Igor Mironchik. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest