From f50edc8673d491ab6b28f650debe7b9b7328417c Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 16 Mar 2012 15:53:45 +0100 Subject: [PATCH] Fix bug #8069: View/Update other formats button disabled with non-TeX fonts --- src/frontends/qt4/GuiToolbar.cpp | 23 +++++++++++++++++++++++ src/frontends/qt4/GuiToolbar.h | 2 ++ status.20x | 3 +++ 3 files changed, 28 insertions(+) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 7915a4ed95..79e669fa4a 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -204,6 +204,7 @@ void MenuButton::mousePressEvent(QMouseEvent * e) m->setWindowTitle(label); m->setTearOffEnabled(true); connect(bar_, SIGNAL(updated()), m, SLOT(updateParent())); + connect(bar_, SIGNAL(updated()), this, SLOT(updateTriggered())); ToolbarInfo const * tbinfo = guiApp->toolbars().info(tbitem_.name_); if (!tbinfo) { LYXERR0("Unknown toolbar " << tbitem_.name_); @@ -227,6 +228,28 @@ void MenuButton::actionTriggered(QAction * action) } +void MenuButton::updateTriggered() +{ + if (!menu()) + return; + + bool enabled = false; + QList acts = menu()->actions(); + for (int i = 0; i < acts.size(); ++i) + if (acts[i]->isEnabled()) { + enabled = true; + break; + } + // Enable the MenuButton if at least one menu item is enabled + setEnabled(enabled); + // If a disabled item is default, switch to InstantPopup + // (this can happen if a user selects e.g. DVI and then + // turns non-TeX fonts on) + if (defaultAction() && !defaultAction()->isEnabled()) + setPopupMode(QToolButton::InstantPopup); +} + + void GuiToolbar::add(ToolbarItem const & item) { switch (item.type_) { diff --git a/src/frontends/qt4/GuiToolbar.h b/src/frontends/qt4/GuiToolbar.h index 636fc97386..c5e1aebee3 100644 --- a/src/frontends/qt4/GuiToolbar.h +++ b/src/frontends/qt4/GuiToolbar.h @@ -59,6 +59,8 @@ private: private Q_SLOTS: /// void actionTriggered(QAction * action); + /// + void updateTriggered(); }; diff --git a/status.20x b/status.20x index e6a94492be..bbda955b51 100644 --- a/status.20x +++ b/status.20x @@ -76,6 +76,9 @@ What's new * USER INTERFACE +- Do not disable View/Update Other Formats button when "Use non-TeX fonts" + is active (bug 8069). + - Do not allow to add a citation in the citation dialog using the key if the Add button is disabled. -- 2.39.5