X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiSymbols.cpp;h=d6a19269385d6f81f2e82ce403afed5a04f907c7;hb=5cb80b867f4a59c3253487652ba74a29ad5b3f0f;hp=ea863b49686fb03137119c61654346e836582305;hpb=c293be56bd12c5dc46e5cedd2828e33918fccef7;p=lyx.git diff --git a/src/frontends/qt/GuiSymbols.cpp b/src/frontends/qt/GuiSymbols.cpp index ea863b4968..d6a1926938 100644 --- a/src/frontends/qt/GuiSymbols.cpp +++ b/src/frontends/qt/GuiSymbols.cpp @@ -169,7 +169,7 @@ QString getBlock(char_type c) // c falls into an uncovered area, but we can guess which if (c > unicode_blocks[lastBlock].end - && c < unicode_blocks[lastBlock + 1].start) + && (lastBlock == no_blocks-1 || c < unicode_blocks[lastBlock + 1].start)) return QString(); // guessing was wrong so far. do a real search. @@ -207,25 +207,25 @@ class GuiSymbols::Model : public QAbstractListModel { public: Model(GuiSymbols * parent) - : QAbstractListModel(parent), encoding_(0) + : QAbstractListModel(parent), encoding_(nullptr) {} - QModelIndex index(int row, int column, QModelIndex const &) const + QModelIndex index(int row, int column, QModelIndex const &) const override { return createIndex(row, column); } - QModelIndex parent(QModelIndex const &) const + QModelIndex parent(QModelIndex const &) const override { return QModelIndex(); } - int rowCount(QModelIndex const &) const + int rowCount(QModelIndex const &) const override { return symbols_.count(); } - QVariant data(QModelIndex const & index, int role) const + QVariant data(QModelIndex const & index, int role) const override { if (!index.isValid()) return QVariant(); @@ -409,12 +409,12 @@ void GuiSymbols::on_symbolsLW_clicked(QModelIndex const & index) } -void GuiSymbols::on_categoryCO_activated(QString const & text) +void GuiSymbols::on_categoryCO_activated(int) { if (!categoryFilterCB->isChecked()) updateSymbolList(false); else - scrollToItem(text); + scrollToItem(categoryCO->currentText()); } @@ -473,11 +473,8 @@ void GuiSymbols::updateSymbolList(bool update_combo) ++numItem; if (show_all || (c >= range_start && c <= range_end)) s.append(c); - if (update_combo) { - QString block = getBlock(c); - if (used_blocks.find(block) == used_blocks.end()) - used_blocks[block] = numItem; - } + if (update_combo) + used_blocks.insert({getBlock(c), numItem}); } model_->setSymbols(s, enc); @@ -507,12 +504,6 @@ void GuiSymbols::dispatchParams() } -Dialog * createGuiSymbols(GuiView & lv) -{ - return new GuiSymbols(lv); -} - - } // namespace frontend } // namespace lyx