[PyKDE] c++ to python translation problem

Hans-Peter Jansen hpj at urpla.net
Tue Sep 3 14:06:01 BST 2002

Hi *,

while trying to translate a c++ sniplet (appeared on qt-interest yesterday),
which syncs two list views vertically, I'm somehow stuck:

class QSyncer : public QObject {
    QSyncer(QScrollView* s1, QScrollView* s2);

public slots:
    void moving1(int x, int y);
    void moving2(int x, int y);

    QScrollView* s1_;
    QScrollView* s2_;

QSyncer::QSyncer(QScrollView* s1, QScrollView* s2) : s1_(s1), s2_(s2) {
    connect(s1, SIGNAL(contentsMoving(int, int)), this, SLOT(moving1(int,
    connect(s2, SIGNAL(contentsMoving(int, int)), this, SLOT(moving2(int,

QSyncer is instanced with two QListViews.

My question is: What happens in the s1_(s1), s2_(s2) sequence?
My understanding is, it just assigns/casts s1/s2 to the protected 
pointers _s1/_s2, which would translate to:

class QSyncer(QObject):
    def __init__(self, s1, s2):
        self._s1 = s1
        self._s2 = s2
        self.connect(s1, SIGNAL("contentsMoving(int, int)"), self.moving1)
        self.connect(s2, SIGNAL("contentsMoving(int, int)"), self.moving2)

How is the transition made from QListView to QScrollView, besides the 
former inherits the latter. The problem is, while the c++ version work 
as expected, my python version don't. The slots in QSyncer are never 

It really must be something obvious, I don't understand...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: qsyncer.py
Type: text/x-python
Size: 1222 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020903/ce18bc74/qsyncer.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qsyncer.h
Type: text/x-chdr
Size: 266 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020903/ce18bc74/qsyncer.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qsyncer.cpp
Type: text/x-c++src
Size: 658 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020903/ce18bc74/qsyncer-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 667 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020903/ce18bc74/main.bin

More information about the PyQt mailing list