mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
GuiRef: only show "<No prefix>" if non-empty
If "Group" is checked, "<No prefix>" 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.
This commit is contained in:
parent
914b1d8200
commit
9887dd48ca
@ -350,19 +350,29 @@ void GuiRef::redoRefs()
|
|||||||
QStringList refsStrings;
|
QStringList refsStrings;
|
||||||
QStringList refsCategories;
|
QStringList refsCategories;
|
||||||
vector<docstring>::const_iterator iter;
|
vector<docstring>::const_iterator iter;
|
||||||
|
bool noprefix = false;
|
||||||
for (iter = refs_.begin(); iter != refs_.end(); ++iter) {
|
for (iter = refs_.begin(); iter != refs_.end(); ++iter) {
|
||||||
QString const lab = toqstr(*iter);
|
QString const lab = toqstr(*iter);
|
||||||
refsStrings.append(lab);
|
refsStrings.append(lab);
|
||||||
if (groupCB->isChecked() && lab.contains(":")) {
|
if (groupCB->isChecked()) {
|
||||||
QString const pref = lab.split(':')[0];
|
if (lab.contains(":")) {
|
||||||
if (!pref.isEmpty() && !refsCategories.contains(pref))
|
QString const pref = lab.split(':')[0];
|
||||||
refsCategories.append(pref);
|
if (!refsCategories.contains(pref)) {
|
||||||
|
if (!pref.isEmpty())
|
||||||
|
refsCategories.append(pref);
|
||||||
|
else
|
||||||
|
noprefix = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
noprefix = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sort categories case-intensively
|
// sort categories case-intensively
|
||||||
qSort(refsCategories.begin(), refsCategories.end(),
|
qSort(refsCategories.begin(), refsCategories.end(),
|
||||||
caseInsensitiveLessThan /*defined above*/);
|
caseInsensitiveLessThan /*defined above*/);
|
||||||
refsCategories.insert(0, qt_("<No prefix>"));
|
if (noprefix)
|
||||||
|
refsCategories.insert(0, qt_("<No prefix>"));
|
||||||
|
|
||||||
if (sortCB->isEnabled() && sortCB->isChecked()) {
|
if (sortCB->isEnabled() && sortCB->isChecked()) {
|
||||||
if(caseSensitiveCB->isEnabled() && caseSensitiveCB->isChecked())
|
if(caseSensitiveCB->isEnabled() && caseSensitiveCB->isChecked())
|
||||||
|
Loading…
Reference in New Issue
Block a user