Exemple #1
0
void moveToForeground()
{
  QWindowList l = QGuiApplication::allWindows();
  if (l.size() > 0 && l.at(0) != nullptr) {
    QWindow* w = l.at(0);
    w->requestActivate();
    if (w->windowState() & Qt::WindowMinimized) {
      w->showNormal();
    }
  }
}
QWindow *QWinEventFilter::findWindow(HWND handle)
{
    QWindow *w = 0;
    QWindowList list = qApp->topLevelWindows();
    for (int i = 0; i < list.size(); i++) {
        if (list.at(i)->winId() == reinterpret_cast<WId>(handle)) {
            w = list.at(i);
            break;
        }
    }
    return w;
}
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;
}