2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-08-03 15:42:14 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-08-03 15:42:14 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-08-03 15:42:14 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-08-03 15:42:14 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-08-03 15:42:14 +02:00
|
|
|
|
|
|
|
|
#include "texteditor_global.h"
|
2010-08-27 12:11:55 +02:00
|
|
|
#include "helpitem.h"
|
2015-02-26 13:22:35 +01:00
|
|
|
|
2017-06-28 14:26:52 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QPoint;
|
|
|
|
|
QT_END_NAMESPACE
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Core { class IEditor; }
|
2010-08-03 15:42:14 +02:00
|
|
|
|
|
|
|
|
namespace TextEditor {
|
|
|
|
|
|
2014-07-23 19:10:38 +02:00
|
|
|
class BaseTextEditor;
|
2014-09-26 11:37:54 +02:00
|
|
|
class TextEditorWidget;
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2017-06-28 14:26:52 +02:00
|
|
|
class TEXTEDITOR_EXPORT BaseHoverHandler
|
2010-08-03 15:42:14 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2014-09-30 13:08:05 +02:00
|
|
|
BaseHoverHandler();
|
2017-06-28 14:26:52 +02:00
|
|
|
virtual ~BaseHoverHandler();
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2014-09-30 13:08:05 +02:00
|
|
|
QString contextHelpId(TextEditorWidget *widget, int pos);
|
2016-01-04 09:17:59 +11:00
|
|
|
int checkToolTip(TextEditorWidget *widget, int pos);
|
2014-09-30 13:08:05 +02:00
|
|
|
void showToolTip(TextEditorWidget *widget, const QPoint &point, int pos);
|
|
|
|
|
|
2016-01-04 09:17:59 +11:00
|
|
|
int priority() const;
|
|
|
|
|
|
2010-08-13 16:38:45 +02:00
|
|
|
protected:
|
|
|
|
|
void setToolTip(const QString &tooltip);
|
|
|
|
|
void appendToolTip(const QString &extension);
|
2010-08-27 12:11:55 +02:00
|
|
|
const QString &toolTip() const;
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2011-01-17 16:29:57 +01:00
|
|
|
void setIsDiagnosticTooltip(bool isDiagnosticTooltip);
|
|
|
|
|
bool isDiagnosticTooltip() const;
|
|
|
|
|
|
2010-08-27 12:11:55 +02:00
|
|
|
void setLastHelpItemIdentified(const HelpItem &help);
|
|
|
|
|
const HelpItem &lastHelpItemIdentified() const;
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2015-12-02 15:45:18 +01:00
|
|
|
virtual void decorateToolTip();
|
|
|
|
|
virtual void operateTooltip(TextEditorWidget *editorWidget, const QPoint &point);
|
2016-01-04 09:17:59 +11:00
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
Priority_None = 0,
|
|
|
|
|
Priority_Tooltip = 5,
|
|
|
|
|
Priority_Help = 10,
|
|
|
|
|
Priority_Diagnostic = 20
|
|
|
|
|
};
|
|
|
|
|
void setPriority(int priority);
|
2010-08-03 15:42:14 +02:00
|
|
|
private:
|
2010-08-27 12:11:55 +02:00
|
|
|
void clear();
|
2014-09-30 13:08:05 +02:00
|
|
|
void process(TextEditorWidget *widget, int pos);
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2016-01-22 11:48:22 +01:00
|
|
|
virtual void identifyMatch(TextEditorWidget *editorWidget, int pos);
|
2010-08-03 15:42:14 +02:00
|
|
|
|
2011-01-17 16:29:57 +01:00
|
|
|
bool m_diagnosticTooltip;
|
2010-08-03 15:42:14 +02:00
|
|
|
QString m_toolTip;
|
2010-08-27 12:11:55 +02:00
|
|
|
HelpItem m_lastHelpItemIdentified;
|
2016-01-04 09:17:59 +11:00
|
|
|
int m_priority;
|
2010-08-03 15:42:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace TextEditor
|