Example #1
0
void QtFallbackWebPopup::show()
{
    if (!pageClient())
        return;

#if ENABLE(SYMBIAN_DIALOG_PROVIDERS)
    TRAP_IGNORE(showS60BrowserDialog());
#else
    populate();
    m_combo->setCurrentIndex(currentIndex());

    QRect rect = geometry();
    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
        if (!m_proxy) {
            m_proxy = new QGraphicsProxyWidget(webView);
            m_proxy->setWidget(m_combo);
        } else
            m_proxy->setVisible(true);
        m_proxy->setGeometry(rect);
    } else {
        m_combo->setParent(pageClient()->ownerWidget());
        m_combo->setGeometry(QRect(rect.left(), rect.top(),
                               rect.width(), m_combo->sizeHint().height()));

    }

    QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
                      Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(m_combo, &event);
#endif
}
void QtFallbackWebPopup::show(const QWebSelectData& data)
{
    if (!pageClient())
        return;

    destroyPopup();
    m_combo = new QtFallbackWebPopupCombo(*this);
    connect(m_combo, SIGNAL(activated(int)),
            SLOT(activeChanged(int)), Qt::QueuedConnection);

    populate(data);

    QRect rect = geometry();
#ifndef QT_NO_GRAPHICSVIEW
    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
        QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView);
        proxy->setWidget(m_combo);
        proxy->setGeometry(rect);
    } else {
        m_combo->setParent(pageClient()->ownerWidget());
        m_combo->setGeometry(QRect(rect.left(), rect.top(),
                                   rect.width(), m_combo->sizeHint().height()));

    }
#else
    m_combo->setParent(pageClient()->ownerWidget());
    m_combo->setGeometry(QRect(rect.left(), rect.top(),
                               rect.width(), m_combo->sizeHint().height()));
#endif

    QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
                      Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(m_combo, &event);
}
void QtMaemoWebPopup::show()
{
    if (!pageClient() || m_popup)
        return;

    m_popup = createPopup();
    m_popup->show();
}
void QtFallbackWebPopup::show(const QWebSelectData& data)
{
    if (!pageClient())
        return;

#if ENABLE(SYMBIAN_DIALOG_PROVIDERS)
    TRAP_IGNORE(showS60BrowserDialog());
#else

    destroyPopup();
    m_combo = new QtFallbackWebPopupCombo(*this);
    connect(m_combo, SIGNAL(activated(int)),
            SLOT(activeChanged(int)), Qt::QueuedConnection);

    populate(data);

    QColor backgroundColor = data.backgroundColor();
    QColor foregroundColor = data.foregroundColor();

    QPalette palette = m_combo->palette();
    if (backgroundColor.isValid())
        palette.setColor(QPalette::Background, backgroundColor);
    if (foregroundColor.isValid())
        palette.setColor(QPalette::Foreground, foregroundColor);
    m_combo->setPalette(palette);


    QRect rect = geometry();
    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
        QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView);
        proxy->setWidget(m_combo);
        proxy->setGeometry(rect);
    } else {
        m_combo->setParent(pageClient()->ownerWidget());
        m_combo->setGeometry(QRect(rect.left(), rect.top(),
                               rect.width(), m_combo->sizeHint().height()));

    }

    QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
                      Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(m_combo, &event);
#endif
}