Example #1
0
/*!
    Return the given top level window for a given position.

    Default implementation retrieves a list of all top level windows and finds the first window
    which contains point \a pos
*/
QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const
{
    QWindowList list = QGuiApplication::topLevelWindows();
    for (int i = list.size()-1; i >= 0; --i) {
        QWindow *w = list[i];
        if (w->isVisible() && w->geometry().contains(pos))
            return w;
    }

    return 0;
}
Example #2
0
QT_BEGIN_NAMESPACE

#ifndef QT_NO_DRAGANDDROP

static QWindow* topLevelAt(const QPoint &pos)
{
    QWindowList list = QGuiApplication::topLevelWindows();
    for (int i = list.count()-1; i >= 0; --i) {
        QWindow *w = list.at(i);
        if (w->isVisible() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w))
            return w;
    }
    return 0;
}
void tst_QWindowContainer::testUnparenting()
{
    QWindow *window = new QWindow();
    QWidget *container = QWidget::createWindowContainer(window);
    container->setGeometry(100, 100, 200, 100);

    window->setParent(0);

    container->show();

    QVERIFY(QTest::qWaitForWindowExposed(container));

    // Window should not be made visible by container..
    QVERIFY(!window->isVisible());
}