Hello good evening ,I am creating an event filter for when a value of a Qspinbox exceeds a value can not access a tab of a QtabWidget.
The problem I have is that if the application is minimized when the value of the QSpinbox exceeds the preset value the tabs disappear and until this value decreases and pass the mouse where the tabs should be these are not displayed.
This is the code i have so far:
import sys
from PySide6.QtWidgets import QApplication, QLabel, QMainWindow,QSpinBox,QHBoxLayout,QMessageBox,QTabWidget,QWidget
from PySide6.QtCore import Qt,QEvent
class MainWindow(QMainWindow):
def init(self):
super().init()
self.setFixedSize(400,200)
a=QWidget()
b=QWidget()
self.tab=QTabWidget(self)
self.tab.addTab(a,"Hola")
self.tab.addTab(b,"Saludos")
self.setCentralWidget(self.tab)
self.tab.tabBar().installEventFilter(self)
self.botón1=QSpinBox(a)
self.botón1.setGeometry(20,20,130,30)
self.botón1.setValue(5)
self.label=QLabel("Ahora lo ves",b)
self.label.setGeometry(140,40,80,60)
def eventFilter(self, object, event):
if object == self.tab.tabBar() and self.botón1.value()>10:
return True
else:
return False