summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/tooltip/tips.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-02-21 16:45:07 +0100
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-02-21 16:51:00 +0100
commitcbafc50acc48d75a1fc993e72bcb6587f8bb9a4e (patch)
treefa639b4e90dfd5e6392d6b7f430e2ac91aece34b /src/plugins/texteditor/tooltip/tips.h
parent6507f5ff835be0e39a235b787cbd62e1943afe89 (diff)
downloadqt-creator-cbafc50acc48d75a1fc993e72bcb6587f8bb9a4e.tar.gz
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>
Diffstat (limited to 'src/plugins/texteditor/tooltip/tips.h')
-rw-r--r--src/plugins/texteditor/tooltip/tips.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/plugins/texteditor/tooltip/tips.h b/src/plugins/texteditor/tooltip/tips.h
index 058209a582..5222a113d1 100644
--- a/src/plugins/texteditor/tooltip/tips.h
+++ b/src/plugins/texteditor/tooltip/tips.h
@@ -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