Color tip for QML; Start of a bit more extensible tooltip class.

This commit is contained in:
Leandro Melo
2010-08-02 14:50:38 +02:00
parent e8ac7ead06
commit 1530273671
10 changed files with 881 additions and 93 deletions

View File

@@ -31,25 +31,20 @@
#define QMLJSHOVERHANDLER_H
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljslookupcontext.h>
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtGui/QColor>
QT_BEGIN_NAMESPACE
class QPoint;
class QStringList;
QT_END_NAMESPACE
namespace Core {
class IEditor;
}
namespace QmlJS {
namespace Interpreter {
class Engine;
class Context;
class Value;
}
}
namespace TextEditor {
class ITextEditor;
}
@@ -57,6 +52,9 @@ class ITextEditor;
namespace QmlJSEditor {
namespace Internal {
class SemanticInfo;
class QmlJSTextEditor;
class HoverHandler : public QObject
{
Q_OBJECT
@@ -72,14 +70,26 @@ private slots:
void editorOpened(Core::IEditor *editor);
private:
void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos);
QString prettyPrint(const QmlJS::Interpreter::Value *value, QmlJS::Interpreter::Context *context,
QStringList *baseClasses) const;
void resetMatchings();
void identifyMatch(TextEditor::ITextEditor *editor, int pos);
bool matchDiagnosticMessage(QmlJSTextEditor *qmlEditor, int pos);
bool matchColorItem(const QmlJS::LookupContext::Ptr &lookupContext,
const QmlJS::Document::Ptr &qmlDocument,
const QList<QmlJS::AST::Node *> &astPath,
unsigned pos);
void handleOrdinaryMatch(const QmlJS::LookupContext::Ptr &lookupContext,
QmlJS::AST::Node *node);
void evaluateHelpCandidates();
QString prettyPrint(const QmlJS::Interpreter::Value *value,
QmlJS::Interpreter::Context *context);
private:
QmlJS::ModelManagerInterface *m_modelManager;
QString m_helpId;
int m_matchingHelpCandidate;
QStringList m_helpCandidates;
QString m_toolTip;
QColor m_colorTip;
};
} // namespace Internal