Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| This patch is supposed to fix the disappearing menus problem on
| Qt/Mac. Bennett, could you tell me whether it helps you? I am not even
| sure that it compiles for qt/mac, actually :)
>
| It should be very transparent for qt/x11.
>
| I guess I should use some scoped_ptr instead of handling my own
| pointer, though.

right... just use scoped_ptr<QMenubar>

| +#ifdef Q_WS_MACX
| +QLMenubar::~QLMenubar()
| +{
| +     delete menubar_;
| +}
| +#endif

then you won't need this.

|  
|  void QLMenubar::openByName(string const & name)
|  {
| @@ -77,6 +86,37 @@ QtView * QLMenubar::view()
|  MenuBackend const & QLMenubar::backend()
|  {
|       return menubackend_;
| +}
| +
| +
| +/*
| +  Here is what the Qt documentation says about how a menubar is chosen:
| +
| +     1) If the window has a QMenuBar then it is used. 2) If the window
| +     is a modal then its menubar is used. If no menubar is specified
| +     then a default menubar is used (as documented below) 3) If the
| +     window has no parent then the default menubar is used (as
| +     documented below).
| +
| +     The above 3 steps are applied all the way up the parent window
| +     chain until one of the above are satisifed. If all else fails a
| +     default menubar will be created, the default menubar on Qt/Mac is
| +     an empty menubar, however you can create a different default
| +     menubar by creating a parentless QMenuBar, the first one created
| +     will thus be designated the default menubar, and will be used
| +     whenever a default menubar is needed.
| +
| +  Thus, for Qt/Mac, we add the menus to a free standing menubar, so
| +  that this menubar will be used also when one of LyX' dialogs has
| +  focus. (JMarc)
| +*/
| +QMenuBar * QLMenubar::menuBar() const
| +{
| +#ifdef Q_WS_MAC
| +     return menubar_;

but here you then need need
    return menubar_.get();

Of course if this pointer is cached somewher a shared_ptr and weak_ptr
should be used.

-- 
        Lgb

Reply via email to