If your control can't fetch keyboard focus in Qt Quick......

Use forceActiveFocus() method.

To get the keyboard focus, you have to set focus:true from the very root of all visual parents the control is attached. If the structure becomes complicated, you have no idea on where to "power on" and where not. In that case, use forceActiveFocus() to make any necessary attribute changes at once.

Man I had to throw away yesterday not knowing this. OTL

Qt Quick에서 뭔 짓을 해도 컨트롤이 키보드 포커스를 가져오지 못한다면......

forceActiveFocus() method를 사용하면 됩니다.

원래 키보드 포커스는 visual parent에서 해당 컨트롤의 모든 부모계통 컨트롤이 속성을 focus: true로 놓도록 설정되어야 잡히는데, 구조가 복잡해지면 어느게 어느거고 어떻게 영향을 받는지 감이 안 잡히는 상황이 발생합니다. 이때 forceActiveFocus()를 사용하면 필요한 부분을 다 알아서 자동으로 바꿔줍니다.

......이거 몰라서 어제 하루 날려먹었네요. OTL

블로그를 이전합니다

뭐, 이런 작은 변방의 블로그에 관심있으신 분들은 아무도 없으시리라 생각합니다만...... (웃음) 블로그 플랫폼을 블로거에서 dev.to로 옮겼습니다. 새 URL은 아래와 같습니다: https://dev.to/teminian 새로운 거처에서 뵙겠습니...

Popular in Code{nested}