本文整理汇总了C++中QWindow::isActive方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::isActive方法的具体用法?C++ QWindow::isActive怎么用?C++ QWindow::isActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::isActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qWidgetShortcutContextMatcher
/*! \internal
Returns true if the widget \a w is a logical sub window of the current
top-level widget.
*/
bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
{
Q_ASSERT_X(object, "QShortcutMap", "Shortcut has no owner. Illegal map state!");
QWidget *active_window = QApplication::activeWindow();
// popups do not become the active window,
// so we fake it here to get the correct context
// for the shortcut system.
if (QApplication::activePopupWidget())
active_window = QApplication::activePopupWidget();
if (!active_window) {
QWindow *qwindow = QGuiApplication::focusWindow();
if (qwindow && qwindow->isActive()) {
while (qwindow) {
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(qwindow);
if (widgetWindow) {
active_window = widgetWindow->widget();
break;
}
qwindow = qwindow->parent();
}
}
}
if (!active_window)
return false;
#ifndef QT_NO_ACTION
if (QAction *a = qobject_cast<QAction *>(object))
return correctActionContext(context, a, active_window);
#endif
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsWidget *gw = qobject_cast<QGraphicsWidget *>(object))
return correctGraphicsWidgetContext(context, gw, active_window);
#endif
QWidget *w = qobject_cast<QWidget *>(object);
if (!w) {
QShortcut *s = qobject_cast<QShortcut *>(object);
if (s)
w = s->parentWidget();
}
if (!w) {
QWindow *qwindow = qobject_cast<QWindow *>(object);
while (qwindow) {
QWidgetWindow *widget_window = qobject_cast<QWidgetWindow *>(qwindow);
if (widget_window) {
w = widget_window->widget();
break;
}
qwindow = qwindow->parent();
}
}
if (!w)
return false;
return correctWidgetContext(context, w, active_window);
}