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