diff options
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsproxywidget.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsproxywidget.cpp | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 7b381367c3..1ff4814142 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qglobal.h" @@ -376,10 +340,10 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) // Run around the focus chain until we find a widget that can take tab focus. if (!child) { - child = next ? (QWidget *)widget : widget->d_func()->focus_prev; + child = next ? widget.data() : widget->previousInFocusChain(); } else { - child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; - if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) { + child = next ? child->nextInFocusChain() : child->previousInFocusChain(); + if ((next && child == widget) || (!next && child == widget->previousInFocusChain())) { return nullptr; } } @@ -396,8 +360,8 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) && !(child->d_func()->extra && child->d_func()->extra->focus_proxy)) { return child; } - child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; - } while (child != oldChild && !(next && child == widget) && !(!next && child == widget->d_func()->focus_prev)); + child = next ? child->nextInFocusChain() : child->previousInFocusChain(); + } while (child != oldChild && !(next && child == widget) && !(!next && child == widget->previousInFocusChain())); return nullptr; } @@ -497,7 +461,7 @@ void QGraphicsProxyWidgetPrivate::embedSubWindow(QWidget *subWin) */ void QGraphicsProxyWidgetPrivate::unembedSubWindow(QWidget *subWin) { - for (QGraphicsItem *child : qAsConst(children)) { + for (QGraphicsItem *child : std::as_const(children)) { if (child->isWidget()) { if (QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(static_cast<QGraphicsWidget *>(child))) { if (proxy->widget() == subWin) { @@ -558,7 +522,7 @@ QGraphicsProxyWidget::~QGraphicsProxyWidget() /*! Embeds \a widget into this proxy widget. The embedded widget must reside exclusively either inside or outside of Graphics View. You cannot embed a - widget as long as it is is visible elsewhere in the UI, at the same time. + widget as long as it is visible elsewhere in the UI, at the same time. \a widget must be a top-level widget whose parent is \nullptr. @@ -1437,7 +1401,7 @@ void QGraphicsProxyWidget::focusOutEvent(QFocusEvent *event) if (QWidget *focusWidget = d->widget->focusWidget()) { // QTBUG-88016 proxyWidget set QTextEdit(QLineEdit etc.) when input preview text, // inputMethod should be reset when proxyWidget lost focus - if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) + if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) QApplication::inputMethod()->reset(); d->removeSubFocusHelper(focusWidget, event->reason()); |