Commit 291b6899 authored by Sven Brauch's avatar Sven Brauch

Fix QuickOpen with Qt 5.11

It remains to be investigated whether this is a regression in Qt
itself, or misuse of the API on our side. There is at least one
misuse (the call to mapFromSource) which is wrong in the old version,
so this patch improves the situation in either case.

Differential Revision: https://phabricator.kde.org/D13517
BUG:395039
parent 96fa7677
......@@ -147,7 +147,7 @@ void KateQuickOpen::update()
/**
* new base mode creation
*/
QStandardItemModel *base_model = new QStandardItemModel(0, 2, this);
m_base_model->clear();
/**
* remember local file names to avoid dupes with project files
......@@ -186,8 +186,8 @@ void KateQuickOpen::update()
QStandardItem *itemUrl = new QStandardItem(doc->url().toString());
itemUrl->setEditable(false);
base_model->setItem(linecount, 0, itemName);
base_model->setItem(linecount, 1, itemUrl);
m_base_model->setItem(linecount, 0, itemName);
m_base_model->setItem(linecount, 1, itemUrl);
linecount++;
if (!doc->url().isEmpty() && doc->url().isLocalFile()) {
......@@ -224,8 +224,8 @@ void KateQuickOpen::update()
QStandardItem *itemUrl = new QStandardItem(doc->url().toString());
itemUrl->setEditable(false);
base_model->setItem(linecount, 0, itemName);
base_model->setItem(linecount, 1, itemUrl);
m_base_model->setItem(linecount, 0, itemName);
m_base_model->setItem(linecount, 1, itemUrl);
linecount++;
if (!doc->url().isEmpty() && doc->url().isLocalFile()) {
......@@ -255,19 +255,12 @@ void KateQuickOpen::update()
QStandardItem *itemUrl = new QStandardItem(file);
itemUrl->setEditable(false);
base_model->setItem(linecount, 0, itemName);
base_model->setItem(linecount, 1, itemUrl);
m_base_model->setItem(linecount, 0, itemName);
m_base_model->setItem(linecount, 1, itemUrl);
linecount++;
}
}
/**
* swap models and kill old one
*/
m_model->setSourceModel(base_model);
delete m_base_model;
m_base_model = base_model;
if (idxToSelect.isValid()) {
m_listView->setCurrentIndex(m_model->mapFromSource(idxToSelect));
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment