diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 43485fa320..5d7b3c4ff1 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -135,7 +135,7 @@ bool GuiToc::initialiseParams(string const & data) { LYXERR(Debug::GUI, data); QString str = QString::fromUtf8(data.c_str()); - string new_type; + QString new_type; if (str.contains("tableofcontents")) new_type = "tableofcontents"; else if (str.contains("floatlist")) { @@ -154,13 +154,13 @@ bool GuiToc::initialiseParams(string const & data) TocList::const_iterator it = tocs.begin(); TocList::const_iterator end = tocs.end(); for (; it != end; ++it) { - types_.push_back(it->first); - type_names_.push_back(guiName(it->first)); + types_.push_back(toqstr(it->first)); + type_names_.push_back(toqstr(guiName(it->first))); toc_models_.push_back(new TocModel(it->second)); } int selected_type = -1; - for (size_t i = 0; i != types_.size(); ++i) { + for (int i = 0; i != types_.size(); ++i) { if (new_type == types_[i]) { selected_type = i; break; @@ -213,7 +213,7 @@ TocIterator GuiToc::currentTocItem(int type) const { BOOST_ASSERT(bufferview()); ParConstIterator it(bufferview()->cursor()); - return buffer().masterBuffer()->tocBackend().item(types_[type], it); + return buffer().masterBuffer()->tocBackend().item(fromqstr(types_[type]), it); } diff --git a/src/frontends/qt4/GuiToc.h b/src/frontends/qt4/GuiToc.h index 99e0e6dba7..9621f3e820 100644 --- a/src/frontends/qt4/GuiToc.h +++ b/src/frontends/qt4/GuiToc.h @@ -21,9 +21,7 @@ #include "TocBackend.h" -#include #include -#include #include @@ -80,8 +78,7 @@ public: TocList const & tocs() const; /// Return the list of types available - std::vector const & typeNames() const - { return type_names_; } + QStringList const & typeNames() const { return type_names_; } /// Return the first TocItem before the cursor TocIterator currentTocItem(int type) const; @@ -97,9 +94,6 @@ public: /// void updateBackend(); - std::vector types_; - std::vector type_names_; - /// Return the guiname from a given cmdName of the TOC param docstring guiName(std::string const & type) const; @@ -109,6 +103,11 @@ public: void dispatchParams(); /// bool isBufferDependent() const { return true; } + + /// + QStringList types_; + /// + QStringList type_names_; }; } // namespace frontend diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp index 299791559a..46985c2fcf 100644 --- a/src/frontends/qt4/TocWidget.cpp +++ b/src/frontends/qt4/TocWidget.cpp @@ -213,8 +213,8 @@ void TocWidget::updateView() void TocWidget::updateGui(int selected_type) { - vector const & type_names = form_.typeNames(); - if (type_names.empty()) { + QStringList const & type_names = form_.typeNames(); + if (type_names.isEmpty()) { enableControls(false); typeCO->clear(); tocTV->setModel(new QStandardItemModel); @@ -225,10 +225,8 @@ void TocWidget::updateGui(int selected_type) QString const current_text = typeCO->currentText(); typeCO->blockSignals(true); typeCO->clear(); - for (size_t i = 0; i != type_names.size(); ++i) { - QString item = toqstr(type_names[i]); - typeCO->addItem(item); - } + for (int i = 0; i != type_names.size(); ++i) + typeCO->addItem(type_names[i]); if (selected_type != -1) typeCO->setCurrentIndex(selected_type); else {