On Mon, Oct 20, 2025 at 11:28:08PM +0200, Pavel Sanda wrote:
> It looks as if QList on mac changed in the way that declaring
> MenuItem::QList<MenuDefinition> submenu_
> with just forward declaration of MenuDefinition is not possible anymore.
>
> As definition of MenuDefinition needs definition of MenuItem::Kind we can't
> just
> changed the order of MenuDefinition/MenuItem classes and we came to limits
> how are these two classes encapsulated in Menus.cpp.
>
> Probably refactoring is needed if we want to have functional Qt 6.10 on mac
> again.
Koji/Stephan, I did the following hack, can you try whether Qt 6.10 compilation
proceeds?
(Essentially change the order for QList<MenuDefinition> to proceed and defer
using enum Kind
inside the definition of the method expandFormats.)
Pavel
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 5c096d0a8a..f6be9dbd95 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -92,8 +92,88 @@ namespace frontend {
namespace {
// macOS specific stuff is at the end.
+class MenuItem;
+///
+class MenuDefinition {
+public:
+ ///
+ typedef std::vector<MenuItem> ItemList;
+ ///
+ typedef ItemList::const_iterator const_iterator;
+ ///
+ explicit MenuDefinition(QString const & name = QString()) : name_(name) {}
+
+ ///
+ void read(Lexer &);
+ ///
+ QString const & name() const { return name_; }
+ ///
+ bool empty() const { return items_.empty(); }
+ /// Clear the menu content.
+ void clear() { items_.clear(); }
+ ///
+ size_t size() const { return items_.size(); }
+ ///
+ const_iterator begin() const { return items_.begin(); }
+ ///
+ const_iterator end() const { return items_.end(); }
+ ///
+ void cat(MenuDefinition const & other);
+ ///
+ void catSub(docstring const & name);
+
+ // search for func in this menu iteratively, and put menu
+ // names in a stack.
+ bool searchMenu(FuncRequest const & func, docstring_list & names)
+ const;
+ ///
+ bool hasFunc(FuncRequest const &) const;
+ /// The real size of the menu considering hidden entries
+ int realSize() const;
+ /// Add the menu item unconditionally
+ void add(MenuItem const & item) { items_.push_back(item); }
+ /// Checks the associated FuncRequest status before adding the
+ /// menu item.
+ void addWithStatusCheck(MenuItem const &);
+ /// Check whether the shortcut of \p mi are unique and valid, and report if not
+ void checkShortcutUnique(MenuItem const & mi) const;
+ /// Return true if a \p sc is a unique shortcut
+ bool checkShortcut(QString const sc) const;
+ /// Try to find a unique shortcut from a string of alternatives
+ QString getBestShortcut(MenuItem const & mi) const;
+ ///
+ void expandLastfiles();
+ void expandDocuments();
+ void expandBookmarks();
+ void expandFormats(MenuItem const &menu, Buffer const * buf);
+ void expandFloatListInsert(Buffer const * buf);
+ void expandFloatInsert(Buffer const * buf);
+ void expandFlexInsert(Buffer const * buf, InsetLyXType type);
+ void expandTocSubmenu(std::string const & type, Toc const & toc_list);
+ void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth, const string & toc_type);
+ void expandToc(Buffer const * buf);
+ void expandPasteRecent(Buffer const * buf);
+ void expandTextBreaks(BufferView const * bv, bool modify = false);
+ void expandToolbars();
+ void expandBranches(Buffer const * buf);
+ void expandIndices(Buffer const * buf, bool listof = false);
+ void expandIndicesContext(Buffer const * buf, bool listof = false);
+ void expandCiteStyles(BufferView const *);
+ void expandInfoArguments(BufferView const *);
+ void expandGraphicsGroups(BufferView const *);
+ void expandSpellingSuggestions(BufferView const *);
+ void expandLanguageSelector(Buffer const * buf);
+ void expandArguments(BufferView const *, bool switcharg = false);
+ void expandCaptions(Buffer const * buf, bool switchcap = false);
+ void expandEnvironmentSeparators(BufferView const *, bool contextmenu = false);
+ void expandQuotes(BufferView const *);
+ void expandZoomOptions(BufferView const *);
+ ///
+ ItemList items_;
+ ///
+ QString name_;
+};
-class MenuDefinition;
///
class MenuItem {
@@ -319,87 +399,6 @@ private:
QList<MenuDefinition> submenu_;
};
-///
-class MenuDefinition {
-public:
- ///
- typedef std::vector<MenuItem> ItemList;
- ///
- typedef ItemList::const_iterator const_iterator;
- ///
- explicit MenuDefinition(QString const & name = QString()) : name_(name) {}
-
- ///
- void read(Lexer &);
- ///
- QString const & name() const { return name_; }
- ///
- bool empty() const { return items_.empty(); }
- /// Clear the menu content.
- void clear() { items_.clear(); }
- ///
- size_t size() const { return items_.size(); }
- ///
- const_iterator begin() const { return items_.begin(); }
- ///
- const_iterator end() const { return items_.end(); }
- ///
- void cat(MenuDefinition const & other);
- ///
- void catSub(docstring const & name);
-
- // search for func in this menu iteratively, and put menu
- // names in a stack.
- bool searchMenu(FuncRequest const & func, docstring_list & names)
- const;
- ///
- bool hasFunc(FuncRequest const &) const;
- /// The real size of the menu considering hidden entries
- int realSize() const;
- /// Add the menu item unconditionally
- void add(MenuItem const & item) { items_.push_back(item); }
- /// Checks the associated FuncRequest status before adding the
- /// menu item.
- void addWithStatusCheck(MenuItem const &);
- /// Check whether the shortcut of \p mi are unique and valid, and report if not
- void checkShortcutUnique(MenuItem const & mi) const;
- /// Return true if a \p sc is a unique shortcut
- bool checkShortcut(QString const sc) const;
- /// Try to find a unique shortcut from a string of alternatives
- QString getBestShortcut(MenuItem const & mi) const;
- ///
- void expandLastfiles();
- void expandDocuments();
- void expandBookmarks();
- void expandFormats(MenuItem::Kind const kind, Buffer const * buf);
- void expandFloatListInsert(Buffer const * buf);
- void expandFloatInsert(Buffer const * buf);
- void expandFlexInsert(Buffer const * buf, InsetLyXType type);
- void expandTocSubmenu(std::string const & type, Toc const & toc_list);
- void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth, const string & toc_type);
- void expandToc(Buffer const * buf);
- void expandPasteRecent(Buffer const * buf);
- void expandTextBreaks(BufferView const * bv, bool modify = false);
- void expandToolbars();
- void expandBranches(Buffer const * buf);
- void expandIndices(Buffer const * buf, bool listof = false);
- void expandIndicesContext(Buffer const * buf, bool listof = false);
- void expandCiteStyles(BufferView const *);
- void expandInfoArguments(BufferView const *);
- void expandGraphicsGroups(BufferView const *);
- void expandSpellingSuggestions(BufferView const *);
- void expandLanguageSelector(Buffer const * buf);
- void expandArguments(BufferView const *, bool switcharg = false);
- void expandCaptions(Buffer const * buf, bool switchcap = false);
- void expandEnvironmentSeparators(BufferView const *, bool contextmenu = false);
- void expandQuotes(BufferView const *);
- void expandZoomOptions(BufferView const *);
- ///
- ItemList items_;
- ///
- QString name_;
-};
-
/// Helper for std::find_if
class MenuNamesEqual
@@ -1184,8 +1183,10 @@ void MenuDefinition::expandBookmarks()
}
-void MenuDefinition::expandFormats(MenuItem::Kind const kind, Buffer const * buf)
+void MenuDefinition::expandFormats(MenuItem const &menu, Buffer const * buf)
{
+ MenuItem::Kind kind = menu.kind();
+
if (!buf && kind != MenuItem::ImportFormats)
return;
@@ -1287,7 +1288,6 @@ void MenuDefinition::expandFormats(MenuItem::Kind const kind, Buffer const * buf
add(item);
}
-
void MenuDefinition::expandFloatListInsert(Buffer const * buf)
{
if (!buf)
@@ -2503,7 +2503,7 @@ void Menus::Impl::expand(MenuDefinition const & frommenu,
case MenuItem::ViewFormats:
case MenuItem::UpdateFormats:
case MenuItem::ExportFormats:
- tomenu.expandFormats(cit->kind(), buf);
+ tomenu.expandFormats(*cit, buf);
break;
case MenuItem::ExportFormat: {
--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel