Am 09.03.2008 um 13:03 schrieb Abdelrazak Younes:

Stefan Schimanski wrote:
Mac has lost the menu contents. They appear in the menubar, but the popup does not appear.

I'll try to investigate. '-dbg gui' should give you some hints of what's going wrong.

Abdel.

diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp
index c51b4ac..c77666d 100644
--- a/src/frontends/qt4/Menus.cpp
+++ b/src/frontends/qt4/Menus.cpp
@@ -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));
        }
@@ -301,19 +301,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
diff --git a/src/frontends/qt4/Menus.h b/src/frontends/qt4/Menus.h
index daafcd3..f17a567 100644
--- a/src/frontends/qt4/Menus.h
+++ b/src/frontends/qt4/Menus.h
@@ -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


Stefan

Attachment: abouttoshow.patch
Description: Binary data


Reply via email to