forked from qt-creator/qt-creator
Fixes: some less caching of the ICore singleton pointer
This commit is contained in:
@@ -74,9 +74,10 @@ using namespace CPlusPlus;
|
|||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class FunctionArgumentWidget : public QLabel {
|
class FunctionArgumentWidget : public QLabel
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FunctionArgumentWidget(Core::ICore *core);
|
FunctionArgumentWidget();
|
||||||
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -183,10 +184,10 @@ protected:
|
|||||||
|
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
|
||||||
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core)
|
FunctionArgumentWidget::FunctionArgumentWidget()
|
||||||
: m_item(0)
|
: m_item(0)
|
||||||
{
|
{
|
||||||
QObject *editorObject = core->editorManager()->currentEditor();
|
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
|
||||||
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
||||||
|
|
||||||
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
|
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
|
||||||
@@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText()
|
|||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core)
|
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
|
||||||
: ICompletionCollector(manager),
|
: ICompletionCollector(manager),
|
||||||
m_core(core),
|
|
||||||
m_manager(manager),
|
m_manager(manager),
|
||||||
m_caseSensitivity(Qt::CaseSensitive),
|
m_caseSensitivity(Qt::CaseSensitive),
|
||||||
m_autoInsertBraces(true),
|
m_autoInsertBraces(true),
|
||||||
@@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
Function *function = symbol->type()->asFunction();
|
Function *function = symbol->type()->asFunction();
|
||||||
QTC_ASSERT(function, return);
|
QTC_ASSERT(function, return);
|
||||||
|
|
||||||
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
|
m_functionArgumentWidget = new FunctionArgumentWidget();
|
||||||
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
||||||
}
|
}
|
||||||
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
||||||
|
|||||||
@@ -34,23 +34,17 @@
|
|||||||
#ifndef CPPCODECOMPLETION_H
|
#ifndef CPPCODECOMPLETION_H
|
||||||
#define CPPCODECOMPLETION_H
|
#define CPPCODECOMPLETION_H
|
||||||
|
|
||||||
// C++ front-end
|
|
||||||
#include <ASTfwd.h>
|
#include <ASTfwd.h>
|
||||||
#include <FullySpecifiedType.h>
|
#include <FullySpecifiedType.h>
|
||||||
#include <cplusplus/Icons.h>
|
#include <cplusplus/Icons.h>
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
#include <cplusplus/TypeOfExpression.h>
|
#include <cplusplus/TypeOfExpression.h>
|
||||||
|
|
||||||
// Qt Creator
|
|
||||||
#include <texteditor/icompletioncollector.h>
|
#include <texteditor/icompletioncollector.h>
|
||||||
|
|
||||||
// Qt
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class ICore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
@@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CppCodeCompletion(CppModelManager *manager, Core::ICore *core);
|
explicit CppCodeCompletion(CppModelManager *manager);
|
||||||
|
|
||||||
bool triggersCompletion(TextEditor::ITextEditable *editor);
|
bool triggersCompletion(TextEditor::ITextEditable *editor);
|
||||||
int startCompletion(TextEditor::ITextEditable *editor);
|
int startCompletion(TextEditor::ITextEditable *editor);
|
||||||
@@ -131,7 +125,6 @@ private:
|
|||||||
TextEditor::ITextEditable *m_editor;
|
TextEditor::ITextEditable *m_editor;
|
||||||
int m_startPosition; // Position of the cursor from which completion started
|
int m_startPosition; // Position of the cursor from which completion started
|
||||||
|
|
||||||
Core::ICore *m_core;
|
|
||||||
CppModelManager *m_manager;
|
CppModelManager *m_manager;
|
||||||
Qt::CaseSensitivity m_caseSensitivity;
|
Qt::CaseSensitivity m_caseSensitivity;
|
||||||
bool m_autoInsertBraces;
|
bool m_autoInsertBraces;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
// Objects
|
// Objects
|
||||||
m_modelManager = new CppModelManager(this);
|
m_modelManager = new CppModelManager(this);
|
||||||
addAutoReleasedObject(m_modelManager);
|
addAutoReleasedObject(m_modelManager);
|
||||||
m_completion = new CppCodeCompletion(m_modelManager, core);
|
m_completion = new CppCodeCompletion(m_modelManager);
|
||||||
addAutoReleasedObject(m_completion);
|
addAutoReleasedObject(m_completion);
|
||||||
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
|
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
|
||||||
core->editorManager());
|
core->editorManager());
|
||||||
|
|||||||
Reference in New Issue
Block a user