forked from qt-creator/qt-creator
Debugger: Make tooltips use standard text editor tooltips.
Extend text editor tooltips by a 'widget content', making it possible to show any widget utilizing the fact that the QTipLabel actually is a frame (and thus a container). Introduce concept of 'interactive' tooltips and modify the tooltip-closing mechanism such that simple interaction is possible. Emit the base text editor's tooltip signals with the correct position and add API to calculate the tooltip position from the cursor position. Add API for pinning tooltips to the text editor (by removing them from the QTipLabel layout). Modify the Debugger's tooltipmanager not to manage tooltips under TextEditor control and to take over control only once tooltips are pinned. Rubber-stamped-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -38,6 +38,8 @@
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
|
||||
namespace TextEditor {
|
||||
class TipContent;
|
||||
}
|
||||
@@ -61,7 +63,9 @@ public:
|
||||
const TextEditor::TipContent &content() const;
|
||||
|
||||
virtual void configure(const QPoint &pos, QWidget *w) = 0;
|
||||
virtual bool handleContentReplacement(const TextEditor::TipContent &content) const = 0;
|
||||
virtual bool canHandleContentReplacement(const TextEditor::TipContent &content) const = 0;
|
||||
|
||||
bool isInteractive() const;
|
||||
|
||||
private:
|
||||
TextEditor::TipContent *m_tipContent;
|
||||
@@ -75,7 +79,7 @@ public:
|
||||
virtual ~ColorTip();
|
||||
|
||||
virtual void configure(const QPoint &pos, QWidget *w);
|
||||
virtual bool handleContentReplacement(const TipContent &content) const;
|
||||
virtual bool canHandleContentReplacement(const TipContent &content) const;
|
||||
|
||||
private:
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
@@ -91,13 +95,31 @@ public:
|
||||
virtual ~TextTip();
|
||||
|
||||
virtual void configure(const QPoint &pos, QWidget *w);
|
||||
virtual bool handleContentReplacement(const TipContent &content) const;
|
||||
virtual bool canHandleContentReplacement(const TipContent &content) const;
|
||||
|
||||
private:
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
};
|
||||
|
||||
class WidgetTip : public QTipLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WidgetTip(QWidget *parent = 0);
|
||||
|
||||
virtual void configure(const QPoint &pos, QWidget *w);
|
||||
virtual bool canHandleContentReplacement(const TipContent &content) const;
|
||||
|
||||
public slots:
|
||||
void pinToolTipWidget();
|
||||
|
||||
private:
|
||||
QWidget *takeWidget(Qt::WindowFlags wf = 0);
|
||||
|
||||
QVBoxLayout *m_layout;
|
||||
};
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
} // namespace Internal
|
||||
} // namespace TextEditor
|
||||
|
||||
Reference in New Issue
Block a user