Hello,

What is the usual way for binding method templates ?



I extended the libfoo with a simple doit template (and some Win32 stuffs) without modifying typesystem_foo.xml :

#ifndef FOO_H
#define FOO_H

#include <QtCore/QtCore>

#ifdef LINK_LIBFOO
   #define MATH_API Q_DECL_IMPORT
#else
   #define MATH_API Q_DECL_EXPORT
#endif

class MATH_API Math : public QObject
{
  Q_OBJECT
public:
  Math() {}
  virtual ~Math() {}
  int squared(int x);

  template<typename T>
  int doit(T x)
  {
    return (int)x;
  }
};

#endif // FOO_H



But when I run the test :

# -*- coding: utf-8 -*-

import unittest
import foo

class MathTest(unittest.TestCase):

  def testDoit(self):
      val = 5.5
      math = foo.Math()
      self.assertEqual(math.doit(val), 5)

I get the error message :

AttributeError: 'foo.Math' object has no attribute 'doit'



I searched some solutions in the shiboken libsample binding and pyside bindings but I can't find a similar example.

Thanks for any advices




_______________________________________________
PySide mailing list
PySide@lists.openbossa.org
http://lists.openbossa.org/listinfo/pyside

Reply via email to