mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
Local aware sorting of the toc type.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25304 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7917f03145
commit
bd569ada80
@ -25,6 +25,8 @@
|
|||||||
#include "support/debug.h"
|
#include "support/debug.h"
|
||||||
#include "support/lassert.h"
|
#include "support/lassert.h"
|
||||||
|
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -160,6 +162,12 @@ int TocModel::modelDepth() const
|
|||||||
TocModels::TocModels(): bv_(0)
|
TocModels::TocModels(): bv_(0)
|
||||||
{
|
{
|
||||||
names_ = new TocTypeModel(this);
|
names_ = new TocTypeModel(this);
|
||||||
|
names_sorted_ = new QSortFilterProxyModel(this);
|
||||||
|
names_sorted_->setSourceModel(names_);
|
||||||
|
#if QT_VERSION >= 0x040300
|
||||||
|
names_sorted_->setSortLocaleAware(true);
|
||||||
|
#endif
|
||||||
|
names_sorted_->sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,6 +206,12 @@ QStandardItemModel * TocModels::model(QString const & type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QAbstractItemModel * TocModels::nameModel()
|
||||||
|
{
|
||||||
|
return names_sorted_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QModelIndex TocModels::currentIndex(QString const & type) const
|
QModelIndex TocModels::currentIndex(QString const & type) const
|
||||||
{
|
{
|
||||||
const_iterator it = models_.find(type);
|
const_iterator it = models_.find(type);
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
class QAbstractItemModel;
|
||||||
|
class QSortFilterProxyModel;
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
class Buffer;
|
class Buffer;
|
||||||
@ -81,7 +84,7 @@ public:
|
|||||||
///
|
///
|
||||||
QStandardItemModel * model(QString const & type);
|
QStandardItemModel * model(QString const & type);
|
||||||
///
|
///
|
||||||
QStandardItemModel * nameModel() { return names_; }
|
QAbstractItemModel * nameModel();
|
||||||
///
|
///
|
||||||
QModelIndex currentIndex(QString const & type) const;
|
QModelIndex currentIndex(QString const & type) const;
|
||||||
///
|
///
|
||||||
@ -106,6 +109,8 @@ private:
|
|||||||
QHash<QString, TocModel *> models_;
|
QHash<QString, TocModel *> models_;
|
||||||
///
|
///
|
||||||
TocTypeModel * names_;
|
TocTypeModel * names_;
|
||||||
|
///
|
||||||
|
QSortFilterProxyModel * names_sorted_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
Loading…
Reference in New Issue
Block a user