* mac menus do not handle showEvent, only the aboutToShow signal.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23588 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-03-09 14:20:16 +00:00
parent 4ffa69eee9
commit 7a924b3771
2 changed files with 31 additions and 11 deletions

View File

@ -281,13 +281,13 @@ public:
};
/// a submenu
class GuiPopupMenu : public QMenu
class GuiPopupMenu : public GuiPopupMenuBase
{
public:
///
GuiPopupMenu(GuiView * gv, MenuItem const & mi, bool top_level)
: QMenu(gv), top_level_menu(top_level? new Menu : 0), view(gv),
name(mi.submenuname())
: GuiPopupMenuBase(gv), top_level_menu(top_level? new Menu : 0),
view(gv), name(mi.submenuname())
{
setTitle(label(mi));
}
@ -309,19 +309,20 @@ public:
/// Get a Menu item label from the menu backend
QString label(MenuItem const & mi) const;
void showEvent(QShowEvent * ev)
{
if (top_level_menu)
guiApp->menus().updateMenu(name);
QMenu::showEvent(ev);
}
/// Only needed for top level menus.
Menu * top_level_menu;
/// our owning view
GuiView * view;
/// the name of this menu
QString name;
private Q_SLOTS:
///
void updateView()
{
if (top_level_menu)
guiApp->menus().updateMenu(name);
}
};
/// Helper for std::find_if

View File

@ -15,9 +15,10 @@
#include "support/docstring.h"
#include <Qmenu>
#include <vector>
class QMenu;
class QString;
namespace lyx {
@ -56,6 +57,24 @@ private:
Impl * const d;
};
class GuiPopupMenuBase : public QMenu
{
Q_OBJECT
public:
///
GuiPopupMenuBase(QWidget * parent = 0)
: QMenu(parent)
{
connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
}
private Q_SLOTS:
///
virtual void updateView() = 0;
};
} // namespace frontend
} // namespace lyx