Command like "Qtab Clicked Connect" that can call a function?
-
Hi @JonB, thank for your attention. I am talking about QTabWidget.
Following picture has two tabs. For example, when i click the "Process" tab, i need the connect to a function. So, is there any command that providing this.
@msyasak
If you are using aQTabWidget
, then the signal is on that, not on the "tab widgets` themselves. In Python it will be:self.qtabwidget.currentChanged.connect(self.tabChanged) def tabChanged(index: int): print(index) print(self.qtabwidget.widget(index)) print(self.qtabwidget.currentWidget())
-
@msyasak
In principle there is theconnect()
method and signals/slots. But there is no such Qt class asQTab
, so what are you actually referring to?@JonB actually, I need the call a function when clicked a tab.
For instance, in button circumstance - there is a connect() function as you mentioned that is
self.qt_button.clicked.connect(self.function)
But, I need such as above command that provide clicked a tab.
-
@JonB actually, I need the call a function when clicked a tab.
For instance, in button circumstance - there is a connect() function as you mentioned that is
self.qt_button.clicked.connect(self.function)
But, I need such as above command that provide clicked a tab.
-
@msyasak
As I already said, I do not know what you mean by "a tab". What Qt class are you talking about? -
Hi @JonB, thank for your attention. I am talking about QTabWidget.
Following picture has two tabs. For example, when i click the "Process" tab, i need the connect to a function. So, is there any command that providing this.
@msyasak
If you are using aQTabWidget
, then the signal is on that, not on the "tab widgets` themselves. In Python it will be:self.qtabwidget.currentChanged.connect(self.tabChanged) def tabChanged(index: int): print(index) print(self.qtabwidget.widget(index)) print(self.qtabwidget.currentWidget())
-
@msyasak
If you are using aQTabWidget
, then the signal is on that, not on the "tab widgets` themselves. In Python it will be:self.qtabwidget.currentChanged.connect(self.tabChanged) def tabChanged(index: int): print(index) print(self.qtabwidget.widget(index)) print(self.qtabwidget.currentWidget())