예제 #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 ToolTip::validateContent(const TipContent &content)
{
    if (!content.isValid()) {
        if (isVisible())
            hideTipWithDelay();
        return false;
    }
    return true;
}
예제 #3
0
void ToolTip::setUp(const QPoint &pos, const TipContent &content, QWidget *w, const QRect &rect)
{
    m_tip->setContent(content);
    m_tip->configure(pos, w);

    placeTip(pos, w);
    setTipRect(w, rect);

    if (m_hideDelayTimer.isActive())
        m_hideDelayTimer.stop();
    m_showTimer.start(content.showTime());
}
예제 #4
0
bool TextTip::canHandleContentReplacement(const TipContent &content) const
{
    if (content.typeId() == TextContent::TEXT_CONTENT_ID)
        return true;
    return false;
}
예제 #5
0
bool ColorTip::canHandleContentReplacement(const TipContent &content) const
{
    if (content.typeId() == ColorContent::COLOR_CONTENT_ID)
        return true;
    return false;
}