GUI: fix crash when adding+moving column in restable
This commit is contained in:
parent
3bbcf6d54d
commit
bd472c71ab
@ -194,7 +194,7 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
|
|||||||
for (QStringList::const_iterator it = fields.begin();
|
for (QStringList::const_iterator it = fields.begin();
|
||||||
it != fields.end(); it++) {
|
it != fields.end(); it++) {
|
||||||
m_fields.push_back((const char *)(it->toUtf8()));
|
m_fields.push_back((const char *)(it->toUtf8()));
|
||||||
m_getters.push_back(chooseGetter(m_fields[m_fields.size()-1]));
|
m_getters.push_back(chooseGetter(m_fields.back()));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hiliter.set_inputhtml(false);
|
g_hiliter.set_inputhtml(false);
|
||||||
@ -397,7 +397,7 @@ void ResTable::init()
|
|||||||
header->setSortIndicator(-1, Qt::AscendingOrder);
|
header->setSortIndicator(-1, Qt::AscendingOrder);
|
||||||
header->setContextMenuPolicy(Qt::CustomContextMenu);
|
header->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(header, SIGNAL(sectionResized(int,int,int)),
|
connect(header, SIGNAL(sectionResized(int,int,int)),
|
||||||
this, SLOT(saveColWidths()));
|
this, SLOT(saveColState()));
|
||||||
connect(header, SIGNAL(customContextMenuRequested(const QPoint&)),
|
connect(header, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||||
this, SLOT(createHeaderPopupMenu(const QPoint&)));
|
this, SLOT(createHeaderPopupMenu(const QPoint&)));
|
||||||
}
|
}
|
||||||
@ -443,38 +443,27 @@ void ResTable::saveColState()
|
|||||||
settings.setValue("resTableSplitterSizes", splitter->saveState());
|
settings.setValue("resTableSplitterSizes", splitter->saveState());
|
||||||
|
|
||||||
QHeaderView *header = tableView->horizontalHeader();
|
QHeaderView *header = tableView->horizontalHeader();
|
||||||
if (header && header->sectionsMoved()) {
|
const vector<string>& vf = m_model->getFields();
|
||||||
// Remember the current column order. Walk in visual order and
|
if (!header) {
|
||||||
// create new list
|
LOGERR(("ResTable::saveColState: no table header ??\n"));
|
||||||
QStringList newfields;
|
|
||||||
vector<int> newwidths;
|
|
||||||
for (int vi = 0; vi < header->count(); vi++) {
|
|
||||||
int li = header->logicalIndex(vi);
|
|
||||||
newfields.push_back(prefs.restableFields.at(li));
|
|
||||||
newwidths.push_back(header->sectionSize(li));
|
|
||||||
}
|
|
||||||
prefs.restableFields = newfields;
|
|
||||||
prefs.restableColWidths = newwidths;
|
|
||||||
} else {
|
|
||||||
const vector<string>& vf = m_model->getFields();
|
|
||||||
prefs.restableFields.clear();
|
|
||||||
for (int i = 0; i < int(vf.size()); i++) {
|
|
||||||
prefs.restableFields.push_back(QString::fromUtf8(vf[i].c_str()));
|
|
||||||
}
|
|
||||||
saveColWidths();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResTable::saveColWidths()
|
|
||||||
{
|
|
||||||
LOGDEB(("ResTable::saveColWidths()\n"));
|
|
||||||
QHeaderView *header = tableView->horizontalHeader();
|
|
||||||
if (!header)
|
|
||||||
return;
|
return;
|
||||||
prefs.restableColWidths.clear();
|
|
||||||
for (int i = 0; i < header->count(); i++) {
|
|
||||||
prefs.restableColWidths.push_back(header->sectionSize(i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remember the current column order. Walk in visual order and
|
||||||
|
// create new list
|
||||||
|
QStringList newfields;
|
||||||
|
vector<int> newwidths;
|
||||||
|
for (int vi = 0; vi < header->count(); vi++) {
|
||||||
|
int li = header->logicalIndex(vi);
|
||||||
|
if (li < 0 || li >= int(vf.size())) {
|
||||||
|
LOGERR(("saveColState: logical index beyond list size!\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
newfields.push_back(QString::fromUtf8(vf[li].c_str()));
|
||||||
|
newwidths.push_back(header->sectionSize(li));
|
||||||
|
}
|
||||||
|
prefs.restableFields = newfields;
|
||||||
|
prefs.restableColWidths = newwidths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResTable::onTableView_currentChanged(const QModelIndex& index)
|
void ResTable::onTableView_currentChanged(const QModelIndex& index)
|
||||||
|
|||||||
@ -96,13 +96,12 @@ public:
|
|||||||
|
|
||||||
virtual ~ResTable() {}
|
virtual ~ResTable() {}
|
||||||
virtual RecollModel *getModel() {return m_model;}
|
virtual RecollModel *getModel() {return m_model;}
|
||||||
virtual void saveColState();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void onTableView_currentChanged(const QModelIndex&);
|
virtual void onTableView_currentChanged(const QModelIndex&);
|
||||||
virtual void on_tableView_entered(const QModelIndex& index);
|
virtual void on_tableView_entered(const QModelIndex& index);
|
||||||
virtual void saveColWidths();
|
|
||||||
virtual void setDocSource(RefCntr<DocSequence> nsource);
|
virtual void setDocSource(RefCntr<DocSequence> nsource);
|
||||||
|
virtual void saveColState();
|
||||||
virtual void resetSource();
|
virtual void resetSource();
|
||||||
virtual void readDocSource(bool resetPos = true);
|
virtual void readDocSource(bool resetPos = true);
|
||||||
virtual void onSortDataChanged(DocSeqSortSpec);
|
virtual void onSortDataChanged(DocSeqSortSpec);
|
||||||
|
|||||||
@ -81,11 +81,17 @@
|
|||||||
|
|
||||||
<h2><a name="b_1_15_2">recoll 1.15.2</a></h2>
|
<h2><a name="b_1_15_2">recoll 1.15.2</a></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Clicking one of the category filter checkboxes (one of the
|
<li>If a result table column is both added and moved in the same
|
||||||
media/message/text/... things) with an empty result list crashes
|
GUI instance, the list becomes garbled (or/and the GUI
|
||||||
the GUI (just like this, yeah, I know, quality insurance
|
crashes). Workaround: remove the Qt GUI config
|
||||||
etc.). Workaround: don't click these before running the first
|
(.config/Recoll.org/recoll.conf), and perform the operation in 2 GUI
|
||||||
query.</li>
|
sessions: add column, exit recoll, restart, move column.</li>
|
||||||
|
|
||||||
|
<li>Clicking one of the category filter checkboxes
|
||||||
|
(one of the media/message/text/... things) with an empty result
|
||||||
|
list crashes the GUI (just like this, yeah, I know, quality
|
||||||
|
insurance etc.). Workaround: don't click these before running the
|
||||||
|
first query.</li>
|
||||||
|
|
||||||
<li>Changing the indexing configuration parameters from the GUI
|
<li>Changing the indexing configuration parameters from the GUI
|
||||||
while the indexing thread (not an external recollindex command) is
|
while the indexing thread (not an external recollindex command) is
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user