QAction shortcuts from QLineEdit
Hi, I have a QLineEdit area where the user types. I also have a bunch of QActions with shortcuts. When the user is typing in the QLineEdit area it triggers QActions due to conflicting shortcut key sequences. Is there a way to disable shortcuts when the QLineEdit area has focus?
Thanks.
Stu
Re: QAction shortcuts from QLineEdit
Like Disco STU I like disco music...
You can try following solutions
a) Check in each QAction-slot-function if QLineEdit has the focus and break execution if true
b) Write your own event handler for QFocusEvent. gotFocus(): disable the signals, lostFocus(): enable it again.
Lykurg
Re: QAction shortcuts from QLineEdit
Where did you assign the actions to? Could we see the code?
Re: QAction shortcuts from QLineEdit
Quote:
Originally Posted by
Lykurg
Like Disco STU I like disco music...
You can try following solutions
a) Check in each QAction-slot-function if QLineEdit has the focus and break execution if true
b) Write your own event handler for QFocusEvent. gotFocus(): disable the signals, lostFocus(): enable it again.
Lykurg
Thanks, but i don't want the action to be disabled, just the shortcut. It seems that the only way you can disable the shortcut is to set it to empty string. So does this mean that everytime QLineEdit get's focus I have to loop through all my QActions and set their shorcuts to "" ?
btw, I am using fullmetalcoder's qshortcutmanager