forked from qt-creator/qt-creator
CppEditor: Fix sorting of quick fixes "Add {public, private, ...} declaration"
Change-Id: I43f09042a525a798d95b3365873be24eafd423e9 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -2334,8 +2334,8 @@ class InsertDeclOperation: public CppQuickFixOperation
|
||||
public:
|
||||
InsertDeclOperation(const QSharedPointer<const CppQuickFixAssistInterface> &interface,
|
||||
const QString &targetFileName, const Class *targetSymbol,
|
||||
InsertionPointLocator::AccessSpec xsSpec, const QString &decl)
|
||||
: CppQuickFixOperation(interface, 0)
|
||||
InsertionPointLocator::AccessSpec xsSpec, const QString &decl, int priority)
|
||||
: CppQuickFixOperation(interface, priority)
|
||||
, m_targetFileName(targetFileName)
|
||||
, m_targetSymbol(targetSymbol)
|
||||
, m_xsSpec(xsSpec)
|
||||
@@ -2397,10 +2397,11 @@ public:
|
||||
, m_decl(decl)
|
||||
{}
|
||||
TextEditor::QuickFixOperation::Ptr
|
||||
operator()(InsertionPointLocator::AccessSpec xsSpec)
|
||||
operator()(InsertionPointLocator::AccessSpec xsSpec, int priority)
|
||||
{
|
||||
return TextEditor::QuickFixOperation::Ptr(
|
||||
new InsertDeclOperation(m_interface, m_fileName, m_matchingClass, xsSpec, m_decl));
|
||||
new InsertDeclOperation(m_interface, m_fileName, m_matchingClass, xsSpec, m_decl,
|
||||
priority));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -2462,12 +2463,12 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
// Add several possible insertion locations for declaration
|
||||
DeclOperationFactory operation(interface, fileName, matchingClass, decl);
|
||||
|
||||
result.append(operation(InsertionPointLocator::Public));
|
||||
result.append(operation(InsertionPointLocator::PublicSlot));
|
||||
result.append(operation(InsertionPointLocator::Protected));
|
||||
result.append(operation(InsertionPointLocator::ProtectedSlot));
|
||||
result.append(operation(InsertionPointLocator::Private));
|
||||
result.append(operation(InsertionPointLocator::PrivateSlot));
|
||||
result.append(operation(InsertionPointLocator::Public, 5));
|
||||
result.append(operation(InsertionPointLocator::PublicSlot, 4));
|
||||
result.append(operation(InsertionPointLocator::Protected, 3));
|
||||
result.append(operation(InsertionPointLocator::ProtectedSlot, 2));
|
||||
result.append(operation(InsertionPointLocator::Private, 1));
|
||||
result.append(operation(InsertionPointLocator::PrivateSlot, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,13 +118,11 @@ struct ContentLessThan
|
||||
} // Anonymous
|
||||
|
||||
BasicProposalItemListModel::BasicProposalItemListModel()
|
||||
: m_isSortingAllowed(true)
|
||||
{}
|
||||
|
||||
BasicProposalItemListModel::BasicProposalItemListModel(const QList<BasicProposalItem *> &items)
|
||||
: m_currentItems(items)
|
||||
, m_originalItems(items)
|
||||
, m_isSortingAllowed(true)
|
||||
{
|
||||
mapPersistentIds();
|
||||
}
|
||||
@@ -141,16 +139,6 @@ void BasicProposalItemListModel::loadContent(const QList<BasicProposalItem *> &i
|
||||
mapPersistentIds();
|
||||
}
|
||||
|
||||
void BasicProposalItemListModel::setSortingAllowed(bool isAllowed)
|
||||
{
|
||||
m_isSortingAllowed = isAllowed;
|
||||
}
|
||||
|
||||
bool BasicProposalItemListModel::isSortingAllowed() const
|
||||
{
|
||||
return m_isSortingAllowed;
|
||||
}
|
||||
|
||||
void BasicProposalItemListModel::mapPersistentIds()
|
||||
{
|
||||
for (int i = 0; i < m_originalItems.size(); ++i)
|
||||
@@ -270,8 +258,6 @@ bool BasicProposalItemListModel::isSortable(const QString &prefix) const
|
||||
{
|
||||
Q_UNUSED(prefix);
|
||||
|
||||
if (!isSortingAllowed())
|
||||
return false;
|
||||
if (m_currentItems.size() < kMaxSort)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -78,7 +78,6 @@ private:
|
||||
|
||||
QHash<QString, int> m_idByText;
|
||||
QList<BasicProposalItem *> m_originalItems;
|
||||
bool m_isSortingAllowed;
|
||||
};
|
||||
|
||||
} // TextEditor
|
||||
|
||||
Reference in New Issue
Block a user