Skip to content
Snippets Groups Projects
Commit 1969b2eb authored by hjk's avatar hjk
Browse files

Fixes: some less caching of the ICore singleton pointer

parent 615660c0
No related branches found
No related tags found
No related merge requests found
......@@ -74,9 +74,10 @@ using namespace CPlusPlus;
namespace CppTools {
namespace Internal {
class FunctionArgumentWidget : public QLabel {
class FunctionArgumentWidget : public QLabel
{
public:
FunctionArgumentWidget(Core::ICore *core);
FunctionArgumentWidget();
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
protected:
......@@ -183,10 +184,10 @@ protected:
using namespace CppTools::Internal;
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core)
FunctionArgumentWidget::FunctionArgumentWidget()
: m_item(0)
{
QObject *editorObject = core->editorManager()->currentEditor();
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
......@@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText()
setText(text);
}
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core)
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
: ICompletionCollector(manager),
m_core(core),
m_manager(manager),
m_caseSensitivity(Qt::CaseSensitive),
m_autoInsertBraces(true),
......@@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
Function *function = symbol->type()->asFunction();
QTC_ASSERT(function, return);
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
m_functionArgumentWidget = new FunctionArgumentWidget();
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
}
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
......
......@@ -34,23 +34,17 @@
#ifndef CPPCODECOMPLETION_H
#define CPPCODECOMPLETION_H
// C++ front-end
#include <ASTfwd.h>
#include <FullySpecifiedType.h>
#include <cplusplus/Icons.h>
#include <cplusplus/Overview.h>
#include <cplusplus/TypeOfExpression.h>
// Qt Creator
#include <texteditor/icompletioncollector.h>
// Qt
#include <QtCore/QObject>
#include <QtCore/QPointer>
namespace Core {
class ICore;
}
namespace TextEditor {
class ITextEditor;
......@@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
{
Q_OBJECT
public:
CppCodeCompletion(CppModelManager *manager, Core::ICore *core);
explicit CppCodeCompletion(CppModelManager *manager);
bool triggersCompletion(TextEditor::ITextEditable *editor);
int startCompletion(TextEditor::ITextEditable *editor);
......@@ -131,7 +125,6 @@ private:
TextEditor::ITextEditable *m_editor;
int m_startPosition; // Position of the cursor from which completion started
Core::ICore *m_core;
CppModelManager *m_manager;
Qt::CaseSensitivity m_caseSensitivity;
bool m_autoInsertBraces;
......
......@@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects
m_modelManager = new CppModelManager(this);
addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager, core);
m_completion = new CppCodeCompletion(m_modelManager);
addAutoReleasedObject(m_completion);
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
core->editorManager());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment