[Qt-interest] [Qt/Mac] Stuck with user focus
Frank Mertens
frank at cyblogic.de
Sat Jan 24 17:39:57 CET 2009
Oh, focus handling can run you mad!-)
Watch out window flags Qt::Tool, Qt::FramelessWindowHint for your
on-screen keyboard.
Maybe QApplication::focusChanged(QWidget*,QWidget*) [signal] and
QWidget::focusProxy() may also be your friends in tricking the
focus policy.
The undesired effects of your mouse clicks you could filter with
an event filter ala QWidget::eventFilter().
More tricks I don't know.
Good luck,
--
Frank
Sergey Uspensky wrote:
> Hello guys!
> Im developing an application for Mac OS Leopard on Qt - kinda onscreen
> keyboard.
> The thing is I need to make MainWindow of the application not accepting
> keyboard focus (user focus) when user clicks on it choosing possible letters
> (keep it always inactivated).
>
> I have already tried both:
>
> in Qt 4.4 (it uses Carbon as far as i know) setFocusPolicy(Qt::NoFocus) -
> the window stops getting focusEvents but still grabs keyboard focus
> and
> in Carbon setting kHIWindowBitNoActivates and kWindowNoActivatesAttribute
> for this WindowRef
>
> Both variants didnt work.
> Are there any workarounds in Carbon or Qt?
>
> Afterwards when the window is off-focus I need to send the key to other
> application(system wide) which currently has user focus. I think
> CGEventCreateKeyboardEvent and then CGEventPost would do the trick?
>
> Any help will be appreciated.
>
> TIA,
> Sergey
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list