mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Try to restore current selected type in case of a toc reset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22963 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
03774c222e
commit
6a877dfc1a
@ -140,10 +140,11 @@ TocList const & GuiToc::tocs() const
|
|||||||
bool GuiToc::initialiseParams(string const & data)
|
bool GuiToc::initialiseParams(string const & data)
|
||||||
{
|
{
|
||||||
LYXERR(Debug::GUI, data);
|
LYXERR(Debug::GUI, data);
|
||||||
LYXERR0(data);
|
|
||||||
QString str = QString::fromUtf8(data.c_str());
|
QString str = QString::fromUtf8(data.c_str());
|
||||||
string new_type = "tableofcontents";
|
string new_type;
|
||||||
if (str.contains("floatlist")) {
|
if (str.contains("tableofcontents"))
|
||||||
|
new_type = "tableofcontents";
|
||||||
|
else if (str.contains("floatlist")) {
|
||||||
if (str.contains("\"figure"))
|
if (str.contains("\"figure"))
|
||||||
new_type = "figure";
|
new_type = "figure";
|
||||||
else if (str.contains("\"table"))
|
else if (str.contains("\"table"))
|
||||||
|
@ -221,7 +221,7 @@ void TocWidget::updateGui(int selected_type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString current_text = typeCO->currentText();
|
QString const current_text = typeCO->currentText();
|
||||||
typeCO->blockSignals(true);
|
typeCO->blockSignals(true);
|
||||||
typeCO->clear();
|
typeCO->clear();
|
||||||
for (size_t i = 0; i != type_names.size(); ++i) {
|
for (size_t i = 0; i != type_names.size(); ++i) {
|
||||||
@ -230,6 +230,12 @@ void TocWidget::updateGui(int selected_type)
|
|||||||
}
|
}
|
||||||
if (selected_type != -1)
|
if (selected_type != -1)
|
||||||
typeCO->setCurrentIndex(selected_type);
|
typeCO->setCurrentIndex(selected_type);
|
||||||
|
else {
|
||||||
|
int const new_index = typeCO->findText(current_text);
|
||||||
|
if (new_index != -1)
|
||||||
|
typeCO->setCurrentIndex(new_index);
|
||||||
|
}
|
||||||
|
|
||||||
typeCO->blockSignals(false);
|
typeCO->blockSignals(false);
|
||||||
|
|
||||||
setTocModel(typeCO->currentIndex());
|
setTocModel(typeCO->currentIndex());
|
||||||
|
Loading…
Reference in New Issue
Block a user