1

I have a very complex custom widget derived from QWidget in PySide.

At first its paintEvent was taking more than 1 second to complete. Then I've implemented a lot of caching with QPixmap to each layer of the "image" that I'm drawing. Now my paintEvent finishes in about 90ms - which is really fine, but not enough.

I'm wondering if I can implement this custom widget in plain C or C++, and then use it as an abstract widget in PySide (like PySide does with all other available widgets).

I found here that in PyQt I could use sip for this. But I can't find a match for this in PySide.

Does any one know how to do that?

Community
  • 1
  • 1
Gustavo Vargas
  • 2,497
  • 2
  • 24
  • 32
  • If you have such perfomance problems, Python might not be the appropriate language for this. Native C++ might be the better implementation language then. – too honest for this site Jun 28 '15 at 01:35
  • 1
    The counterpart to `sip` is [shiboken](http://seanfisk.com/pyside-docs/shiboken/). – ekhumoro Jun 28 '15 at 01:58
  • @Olaf it is a huge application already developed 100% in pyside/python. It is working very well, except for this single widget (it has to manage a very huge list of items to print some and ignore some). I'm looking to implement it in C as an optimization since I have no more ideia do optimize even more in python. – Gustavo Vargas Jun 28 '15 at 04:05
  • @ekhumoro thank you, this information wasn't clear for me. Any example? – Gustavo Vargas Jun 28 '15 at 04:06
  • Perhaps [this](http://lynxline.com/superhybrids-part-2-now-qt-pyside/) will be of use – three_pineapples Jun 28 '15 at 08:43
  • @three_pineapples this one, for sure, is the best example I got so far. Thanks. It is a little old, but I'm sure I can use it a good start point. If you post it as an anwer I can accept it. – Gustavo Vargas Jun 29 '15 at 02:43
  • @GustavoVargas It's not considered acceptable to post link only answers here, which is why I made it a comment! I actually found it through another [SO post](http://stackoverflow.com/q/27047323/1994235) anyway, so shouldn't really take credit. Unfortunately, while a nice question, it is difficult to answer acceptably without writing an overly long and detailed answer! So I think I'll leave it as a comment and direct people to the [wayback machine](http://archive.org/web/) if the link ever breaks in the future :) – three_pineapples Jun 29 '15 at 11:58
  • @three_pineapples, funny you should say that, the link didn't work for me. And the wayback machine won't work, b/c of sites robots.txt – IronManMark20 Jul 02 '15 at 05:15
  • @IronManMark20 Looks like when the database went down, it caused the robots.txt to change stopping the wayback machine from working (I did check that it had a copy before posting my previous comment!). It is still available through [Google Cache](http://webcache.googleusercontent.com/search?q=cache:jqLZIIsxoMcJ:lynxline.com/superhybrids-part-2-now-qt-pyside/) though. – three_pineapples Jul 02 '15 at 05:27
  • @three_pineapples, thanks! – IronManMark20 Jul 02 '15 at 14:15

0 Answers0