PDA

View Full Version : Drawer Goofiness



Brandybuck
4th January 2007, 09:16
I'm writing an app that makes use of a drawer on the Mac (it's a normal dock widget everywhere else). But I'm encountering some strange behavior, and wondered if other people have experience with Mac drawers, and might have some advice for me. The couple of paragraphs in the recent QQ is woefully scant.

As near as I can tell, the drawer isn't in the visible state (isVisible()) until after it has completed its animation. Which is about a half second after the main window is shown. A side effect of this, is that when I show() the drawer it ends up not being shown. Hiding a drawer works correctly. After it is initially animated open, show() and hide() work as expected. Is this normal behavior?

Also, is there any way to know when the drawer has finished animating open (or closed)? Is there a Mac event I can watch for?

Any juicy gossip on how drawers work would be appreciated. Thanks.

Moppel
4th January 2007, 12:51
IIRC, the mainwindow example within the demos folder shows one of the widgets as a drawer and it's shown right after you launch the app.
Maybe this can give you some ideas.

Brandybuck
4th January 2007, 18:34
Yes, the example does show it. But at the instant the app starts the drawer is closed, and then it animates open over the course of the next half second. One problem I am facing is trying to restore the drawer state. But because of this behavior, I have to treat the initial display as a special case, because I can't just hide or show it (or use toggleViewAction()) as I would in subsequent cases.

Note that other Mac apps (preview) open with their drawers already extended, it's just the Qt apps that have this initial animation.

Moppel
4th January 2007, 23:39
Upps, now I've seen it myself. Just compiled a qt43 snapshot and it still does it.
But - sorry if I got you wrong - isn't the example doing what you wan't. The drawer beeing shown after the app is launched. Right, there is this animation but in the end it is shown.
It's a bit too late for me now to look how they do it. Is there a flag for this animation. (I know the introduced some animation for treewidgets recently (qt 4.2 iirc) and you can disable them).

Brandybuck
5th January 2007, 00:40
There is no flag for the animation that I can find. The reason this is an issue, is that I want to restore the drawer state at startup. But out of a warped sense of aesthetics I don't want to treat the app startup as a special case.