#include "Undo.h"
#include "VCBackend.h"
#include "version.h"
+#include "WordList.h"
#include "insets/InsetBibitem.h"
#include "insets/InsetBibtex.h"
~GuiCompletionModel()
{ delete list_; }
///
+ bool sorted() const
+ {
+ if (list_)
+ return list_->sorted();
+ else
+ return false;
+ }
+ ///
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const
{
return 2;
Inset::CompletionList const * list
= cur.inset().createCompletionList(cur);
setModel(new GuiCompletionModel(this, list));
+ if (list->sorted())
+ setModelSorting(QCompleter::CaseSensitivelySortedModel);
+ else
+ setModelSorting(QCompleter::UnsortedModel);
// show popup
if (popupUpdate)
///
virtual ~CompletionList() {}
///
+ virtual bool sorted() const =0;
+ ///
virtual size_t size() const =0;
/// returns the string shown in the gui.
virtual docstring data(size_t idx) const =0;
#include "TextClass.h"
#include "TextMetrics.h"
#include "TexRow.h"
+#include "WordList.h"
#include "frontends/alert.h"
#include "frontends/Painter.h"
public:
///
TextCompletionList(Cursor const & cur)
- : buf_(cur.buffer()), it_(buf_.registeredWords().begin()), pos_(0) {}
+ : buf_(cur.buffer()), pos_(0) {}
///
virtual ~TextCompletionList() {}
+ ///
+ virtual bool sorted() const { return true; }
///
virtual size_t size() const {
return buf_.registeredWords().size();
}
///
virtual docstring data(size_t idx) const {
- std::set<docstring>::const_iterator it
- = buf_.registeredWords().begin();
- for (size_t i = 0; i < idx; ++i)
- it++;
- return *it;
+ return buf_.registeredWords().word(idx);
}
private:
Buffer const & buf_;
- std::set<docstring>::const_iterator const it_;
size_t pos_;
};
class ParagraphList;
class InsetTabular;
-class WordList : public std::set<docstring> {};
-
/**
A text inset is like a TeX box to write full text
(including styles and other insets) in a given space.
///
virtual ~MathCompletionList();
+ ///
+ virtual bool sorted() const { return false; }
///
virtual size_t size() const;
///