From 94ede89c5749ec664815353c5366a10156c11e67 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 3 Jan 2011 14:39:41 +0000 Subject: [PATCH] Fix bug #7099: Math toolbars don't autoshow. In GuiApplication::readUIFile() the settings for views gets removed if the ui file is newer than the saved timestamp in the settings. Later the non existing settings will be used to initialize the visibility. The default value for a non existing setting is 0. The visibility_ variable does never get changed afterwards. And therefore we will again write 0 to the registry. We should have read the ui file instead when we can't find the registry value. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37075 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiToolbar.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 05e97e912a..93ea4c7552 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -326,7 +326,17 @@ void GuiToolbar::saveSession() const void GuiToolbar::restoreSession() { QSettings settings; - setVisibility(settings.value(sessionKey() + "/visibility").toInt()); + int const error_val = -1; + int visibility = + settings.value(sessionKey() + "/visibility", error_val).toInt(); + if (visibility == error_val || visibility == 0) { + // The settings have not been found. This can happen when + // the ui file has changed so that we use the settings from + // the new ui file rather than the old settings. + visibility = + guiApp->toolbars().defaultVisibility(fromqstr(objectName())); + } + setVisibility(visibility); } -- 2.39.2