how to execute a QCombobox Pyqt6 cursor output method
-
Agreed ! Thank you ! I'm new to Qt and Python, I must admit I had a hard time understanding what you're asking to do.
Do I have to call the QFocusEvent class in the QCombobox class?
I'm sorry to ask so many questions but this is really new to me.
Thank you in advance.
-
@jsulm
Thank you (sorry! I keep telling you but help is always useful, especially when you're just starting out), so I tried but I have a problem with the focusOutEvent method, which I can't seem to figure out the meaning of or event = QFocusEvent.The error is:
TypeError: focusOutEvent(self, QFocusEvent): argument 1 has unexpected type 'PyQt6.sip.wrappertype'Thank you for everything and if you don't mind and if it's not too long, would you be able to explain to me? I admit that I swim a little.
-
Hi,
@Jbone73 said in how to execute a QCombobox Pyqt6 cursor output method:
@jsulm
This is the one you shared with me, I note it below:class ComboBox(QComboBox): def focusOutEvent(self, event=QFocusEvent): super().focusOutEvent(event)
What about ?
class ComboBox(QComboBox): def focusOutEvent(self, event): super().focusOutEvent(event)
If you want type hints:
class ComboBox(QComboBox): def focusOutEvent(self, event: QFocusEvent) -> None: super().focusOutEvent(event)
-
@SGaist
Hello !
I don't understand ??If I use your code :
class ComboBox(QComboBox): def focusOutEvent(self, event: QFocusEvent) -> None: super().focusOutEvent(event)
Or
class ComboBox(QComboBox): def focusOutEvent(self, event): super().focusOutEvent(event)
I have messages of errors and it does not work, on the other hand, if I put:
class ComboBox(QComboBox): def focusOutEvent(self, event=QFocusEvent): print('ok')
I do not have problem anymore, it works but not correctly.
The cursor of the combobox remains active when it takes the focus and I meet with another focus on other Widgets.I do not understand why this does not work correctly???
-
Can you provide a minimal complete script to reproduce this behaviour ?