C++ Preprocessor additions widget.

Introducing a Widget with a SnippetEditor and a C++ Highlighter which
should provide additional information to the C++ preprocessor for a
specific file.

Change-Id: I27f9498c7e52d1493d6ea92a02a2c6d26130fe07
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
David Schulz
2013-08-20 07:46:19 +02:00
committed by Erik Verbruggen
parent 1a8ef7f312
commit d411c07643
11 changed files with 480 additions and 28 deletions

View File

@@ -67,29 +67,7 @@ ToolTip *ToolTip::instance()
void ToolTip::show(const QPoint &pos, const TipContent &content, QWidget *w, const QRect &rect)
{
ToolTip *t = instance();
if (t->acceptShow(content, pos, w, rect)) {
QWidget *target = 0;
if (HostOsInfo::isWindowsHost())
target = QApplication::desktop()->screen(Internal::screenNumber(pos, w));
else
target = w;
switch (content.typeId()) {
case TextContent::TEXT_CONTENT_ID:
t->m_tip = new TextTip(target);
break;
case ColorContent::COLOR_CONTENT_ID:
t->m_tip = new ColorTip(target);
break;
case WidgetContent::WIDGET_CONTENT_ID:
t->m_tip = new WidgetTip(target);
break;
}
t->setUp(pos, content, w, rect);
qApp->installEventFilter(t);
t->showTip();
}
instance()->showInternal(pos, content, w, rect);
}
void ToolTip::show(const QPoint &pos, const TipContent &content, QWidget *w)
@@ -214,6 +192,32 @@ void ToolTip::hideTipImmediately()
qApp->removeEventFilter(this);
}
void ToolTip::showInternal(const QPoint &pos, const TipContent &content, QWidget *w, const QRect &rect)
{
if (acceptShow(content, pos, w, rect)) {
QWidget *target = 0;
if (HostOsInfo::isWindowsHost())
target = QApplication::desktop()->screen(Internal::screenNumber(pos, w));
else
target = w;
switch (content.typeId()) {
case TextContent::TEXT_CONTENT_ID:
m_tip = new TextTip(target);
break;
case ColorContent::COLOR_CONTENT_ID:
m_tip = new ColorTip(target);
break;
case WidgetContent::WIDGET_CONTENT_ID:
m_tip = new WidgetTip(target);
break;
}
setUp(pos, content, w, rect);
qApp->installEventFilter(this);
showTip();
}
}
void ToolTip::placeTip(const QPoint &pos, QWidget *w)
{
QRect screen = Internal::screenGeometry(pos, w);
@@ -254,7 +258,7 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
}
#endif
case QEvent::Leave:
if (o == m_tip)
if (o == m_tip && !m_tip->isAncestorOf(qApp->focusWidget()))
hideTipWithDelay();
break;
case QEvent::Enter: