Commit f14c50da authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Simplified the structure of the CompletionWidget

Done-with: Roberto Raggi <roberto.raggi@nokia.com>
parent ba9a197e
This diff is collapsed.
......@@ -33,8 +33,6 @@
#include <QtGui/QListView>
#include <QPointer>
class AutoCompletionModel;
namespace TextEditor {
struct CompletionItem;
......@@ -42,42 +40,70 @@ class ITextEditable;
namespace Internal {
class AutoCompletionModel;
class CompletionSupport;
class CompletionListView;
/* The completion widget is responsible for showing a list of possible completions.
It is only used by the CompletionSupport.
*/
class CompletionWidget : public QListView
class CompletionWidget : public QFrame
{
Q_OBJECT
public:
CompletionWidget(CompletionSupport *support, ITextEditable *editor);
~CompletionWidget();
void setQuickFix(bool quickFix);
void setCompletionItems(const QList<TextEditor::CompletionItem> &completionitems);
void showCompletions(int startPos);
void keyboardSearch(const QString &search);
signals:
void itemSelected(const TextEditor::CompletionItem &item);
void completionListClosed();
public slots:
void closeList(const QModelIndex &index = QModelIndex());
protected:
bool event(QEvent *e);
private:
void updatePositionAndSize(int startPos);
private:
CompletionSupport *m_support;
ITextEditable *m_editor;
CompletionListView *m_completionListView;
};
class CompletionListView : public QListView
{
Q_OBJECT
public:
~CompletionListView();
signals:
void itemSelected(const TextEditor::CompletionItem &item);
void completionListClosed();
private slots:
void completionActivated(const QModelIndex &index);
protected:
bool event(QEvent *e);
private:
void updatePositionAndSize(int startPos);
friend class CompletionWidget;
CompletionListView(CompletionSupport *support, ITextEditable *editor, CompletionWidget *completionWidget);
void setQuickFix(bool quickFix);
void setCompletionItems(const QList<TextEditor::CompletionItem> &completionitems);
void keyboardSearch(const QString &search);
void closeList(const QModelIndex &index);
QPointer<QFrame> m_popupFrame;
bool m_blockFocusOut;
bool m_quickFix;
ITextEditable *m_editor;
QWidget *m_editorWidget;
CompletionWidget *m_completionWidget;
AutoCompletionModel *m_model;
CompletionSupport *m_support;
};
......
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