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(); } }
bool TextTip::canHandleContentReplacement(const TipContent &content) const { if (content.typeId() == TextContent::TEXT_CONTENT_ID) return true; return false; }
bool ColorTip::canHandleContentReplacement(const TipContent &content) const { if (content.typeId() == ColorContent::COLOR_CONTENT_ID) return true; return false; }