]> git.lyx.org Git - features.git/commitdiff
Fix bug #8069: View/Update other formats button disabled with non-TeX fonts
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 16 Mar 2012 14:53:45 +0000 (15:53 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 16 Mar 2012 14:53:45 +0000 (15:53 +0100)
src/frontends/qt4/GuiToolbar.cpp
src/frontends/qt4/GuiToolbar.h
status.20x

index 7915a4ed9568fcab0ad54456f29c0f4f86c48a74..79e669fa4a9cfd470764e63d9f5f17c74b261cb7 100644 (file)
@@ -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<QAction *> 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_) {
index 636fc973860e8ee4979f48cc072b8bc6e0044aeb..c5e1aebee360ee2eef82386423b0766ebd6c4499 100644 (file)
@@ -59,6 +59,8 @@ private:
 private Q_SLOTS:
        ///
        void actionTriggered(QAction * action);
+       ///
+       void updateTriggered();
 };
 
 
index e6a94492be0037022bc6c30458ee33a766b1a714..bbda955b515f2a024e80d6a56199d8e386460230 100644 (file)
@@ -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
   <Enter> key if the Add button is disabled.