当前位置: 首页>>代码示例>>C++>>正文


C++ QWindow::requestActivate方法代码示例

本文整理汇总了C++中QWindow::requestActivate方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::requestActivate方法的具体用法?C++ QWindow::requestActivate怎么用?C++ QWindow::requestActivate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWindow的用法示例。


在下文中一共展示了QWindow::requestActivate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleFocusEvent

/* Compress activation events. If the next focus window is already known
 * at the time the current one receives focus-out, pass that to
 * QWindowSystemInterface instead of sending 0 and ignore its consecutive
 * focus-in event.
 * This helps applications that do handling in focus-out events. */
void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
                                       QWindowsWindow *platformWindow)
{
    QWindow *nextActiveWindow = 0;
    if (et == QtWindows::FocusInEvent) {
        QWindow *topWindow = QWindowsWindow::topLevelOf(platformWindow->window());
        QWindow *modalWindow = 0;
        if (QGuiApplicationPrivate::instance()->isWindowBlocked(topWindow, &modalWindow) && topWindow != modalWindow) {
            modalWindow->requestActivate();
            return;
        }
        // QTBUG-32867: Invoking WinAPI SetParent() can cause focus-in for the
        // window which is not desired for native child widgets.
        if (platformWindow->testFlag(QWindowsWindow::WithinSetParent)) {
            QWindow *currentFocusWindow = QGuiApplication::focusWindow();
            if (currentFocusWindow && currentFocusWindow != platformWindow->window()) {
                currentFocusWindow->requestActivate();
                return;
            }
        }
        nextActiveWindow = platformWindow->window();
    } else {
        // Focus out: Is the next window known and different
        // from the receiving the focus out.
        if (const HWND nextActiveHwnd = GetFocus())
            if (QWindowsWindow *nextActivePlatformWindow = findClosestPlatformWindow(nextActiveHwnd))
                if (nextActivePlatformWindow != platformWindow)
                    nextActiveWindow = nextActivePlatformWindow->window();
    }
    if (nextActiveWindow != d->m_lastActiveWindow) {
         d->m_lastActiveWindow = nextActiveWindow;
         QWindowSystemInterface::handleWindowActivated(nextActiveWindow);
    }
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:39,代码来源:qwindowscontext.cpp

示例2: onOpenWindow

void Nexus::onOpenWindow(QObject* object)
{
    QWindow* window = static_cast<QWindow*>(object);

    if (window->windowState() & QWindow::Minimized)
        window->showNormal();

    window->raise();
    window->requestActivate();
}
开发者ID:13983441921,项目名称:qTox,代码行数:10,代码来源:nexus.cpp

示例3: moveToForeground

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();
    }
  }
}
开发者ID:Acly,项目名称:hdrv,代码行数:11,代码来源:Main.cpp

示例4: eventWindow

QWindow* TestService::eventWindow(QObject* _item)
{
    QQuickItem* item = qobject_cast<QQuickItem*>(_item);
    if (item && item->window())
        return item->window();

    QWindow* window = qobject_cast<QQuickWindow*>(_item);
    if (!window && _item->parent())
        window = eventWindow(_item->parent());
    if (!window)
        window = qobject_cast<QQuickWindow*>(m_targetWindow);
    if (window)
    {
        window->requestActivate();
        std::cout << window->title().toStdString();
        return window;
    }
    item = qobject_cast<QQuickItem*>(m_targetWindow);
    if (item)
        return item->window();
    return 0;
}
开发者ID:BitcoinKinetics,项目名称:cpp-ethereum,代码行数:22,代码来源:TestService.cpp

示例5: testActivation

void tst_QWindowContainer::testActivation()
{
    QWidget root;

    QWindow *window = new QWindow();
    QWidget *container = QWidget::createWindowContainer(window, &root);

    container->setGeometry(100, 100, 200, 100);
    root.setGeometry(100, 100, 400, 300);

    root.show();
    root.activateWindow();
    QVERIFY(QTest::qWaitForWindowExposed(&root));

    QVERIFY(QTest::qWaitForWindowActive(root.windowHandle()));
    QVERIFY(QGuiApplication::focusWindow() == root.windowHandle());

    // Verify that all states in the root widget indicate it is active
    QVERIFY(root.windowHandle()->isActive());
    QVERIFY(root.isActiveWindow());
    QCOMPARE(root.palette().currentColorGroup(), QPalette::Active);

    // Under KDE (ubuntu 12.10), we experience that doing two activateWindow in a row
    // does not work. The second gets ignored by the window manager, even though the
    // timestamp in the xcb connection is unique for both.
    if (QGuiApplication::platformName() == "xcb")
        QTest::qWait(100);

    window->requestActivate();
    QTRY_VERIFY(QGuiApplication::focusWindow() == window);

    // Verify that all states in the root widget still indicate it is active
    QVERIFY(root.windowHandle()->isActive());
    QVERIFY(root.isActiveWindow());
    QCOMPARE(root.palette().currentColorGroup(), QPalette::Active);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:36,代码来源:tst_qwindowcontainer.cpp


注:本文中的QWindow::requestActivate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。