From 9887dd48ca52914b79763b8d689cbe5f335938b9 Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Fri, 19 Apr 2013 07:48:26 -0400 Subject: [PATCH] GuiRef: only show "" if non-empty If "Group" is checked, "" is shown only if there exists a label with no prefix. Before, it was shown even when it was empty and even when there were no labels at all. --- src/frontends/qt4/GuiRef.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index c79dcb9139..9e64750486 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -350,19 +350,29 @@ void GuiRef::redoRefs() QStringList refsStrings; QStringList refsCategories; vector::const_iterator iter; + bool noprefix = false; for (iter = refs_.begin(); iter != refs_.end(); ++iter) { QString const lab = toqstr(*iter); refsStrings.append(lab); - if (groupCB->isChecked() && lab.contains(":")) { - QString const pref = lab.split(':')[0]; - if (!pref.isEmpty() && !refsCategories.contains(pref)) - refsCategories.append(pref); + if (groupCB->isChecked()) { + if (lab.contains(":")) { + QString const pref = lab.split(':')[0]; + if (!refsCategories.contains(pref)) { + if (!pref.isEmpty()) + refsCategories.append(pref); + else + noprefix = true; + } + } + else + noprefix = true; } } // sort categories case-intensively qSort(refsCategories.begin(), refsCategories.end(), caseInsensitiveLessThan /*defined above*/); - refsCategories.insert(0, qt_("")); + if (noprefix) + refsCategories.insert(0, qt_("")); if (sortCB->isEnabled() && sortCB->isChecked()) { if(caseSensitiveCB->isEnabled() && caseSensitiveCB->isChecked()) -- 2.39.5