Qiao
Qiao

Reputation: 17049

Where to look for parameter that was just returned by signal?

QTabWidget has signal currentChanged(). And it returns index of current tab.
But how can I get this parameter in such expression:

tabs.currentChanged.connect(lambda: foo());

def foo(index):
    ...

Where should I look for this parameter that was just returned?

Upvotes: 1

Views: 136

Answers (1)

Mat
Mat

Reputation: 206879

Signals don't "return" anything. They can have parameters though, which is the case for currentIndex. If you want that argument passed to your function, you should try:

tabs.currentChanged.connect(lambda index: foo(index));

Upvotes: 3

Related Questions