reset table header after failed trial to sort by inverse relevance
This commit is contained in:
parent
bfa786dfeb
commit
00cb2ad827
@ -16,11 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#include "restable.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
@ -34,12 +37,11 @@
|
|||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include <memory>
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "restable.h"
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "reslistpager.h"
|
#include "reslistpager.h"
|
||||||
#include "reslist.h"
|
#include "reslist.h"
|
||||||
@ -228,8 +230,9 @@ string RecollModel::baseField(const string& field)
|
|||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
RecollModel::RecollModel(const QStringList fields, QObject *parent)
|
RecollModel::RecollModel(const QStringList fields, ResTable *tb,
|
||||||
: QAbstractTableModel(parent), m_ignoreSort(false)
|
QObject *parent)
|
||||||
|
: QAbstractTableModel(parent), m_table(tb), m_ignoreSort(false)
|
||||||
{
|
{
|
||||||
// Initialize the translated map for column headers
|
// Initialize the translated map for column headers
|
||||||
o_displayableFields["abstract"] = tr("Abstract");
|
o_displayableFields["abstract"] = tr("Abstract");
|
||||||
@ -439,6 +442,7 @@ void RecollModel::sort(int column, Qt::SortOrder order)
|
|||||||
order != Qt::AscendingOrder) {
|
order != Qt::AscendingOrder) {
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("Can't sort by inverse relevance"));
|
tr("Can't sort by inverse relevance"));
|
||||||
|
QTimer::singleShot(0, m_table, SLOT(resetSort()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!stringlowercmp("date", spec.field) ||
|
if (!stringlowercmp("date", spec.field) ||
|
||||||
@ -506,7 +510,7 @@ public:
|
|||||||
|
|
||||||
void ResTable::init()
|
void ResTable::init()
|
||||||
{
|
{
|
||||||
if (!(m_model = new RecollModel(prefs.restableFields)))
|
if (!(m_model = new RecollModel(prefs.restableFields, this)))
|
||||||
return;
|
return;
|
||||||
tableView->setModel(m_model);
|
tableView->setModel(m_model);
|
||||||
tableView->setMouseTracking(true);
|
tableView->setMouseTracking(true);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class RecollModel : public QAbstractTableModel {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RecollModel(const QStringList fields, QObject *parent = 0);
|
RecollModel(const QStringList fields, ResTable *tb, QObject *parent = 0);
|
||||||
|
|
||||||
// Reimplemented methods
|
// Reimplemented methods
|
||||||
virtual int rowCount (const QModelIndex& = QModelIndex()) const;
|
virtual int rowCount (const QModelIndex& = QModelIndex()) const;
|
||||||
@ -73,6 +73,7 @@ signals:
|
|||||||
void sortDataChanged(DocSeqSortSpec);
|
void sortDataChanged(DocSeqSortSpec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ResTable *m_table{0};
|
||||||
mutable std::shared_ptr<DocSequence> m_source;
|
mutable std::shared_ptr<DocSequence> m_source;
|
||||||
std::vector<std::string> m_fields;
|
std::vector<std::string> m_fields;
|
||||||
std::vector<FieldGetter*> m_getters;
|
std::vector<FieldGetter*> m_getters;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user