summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp66
1 files changed, 46 insertions, 20 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 479d91be0e..e94520021e 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -783,6 +783,8 @@ void QWidget::setAutoFillBackground(bool enabled)
and a compositing window manager.
\li Windows: The widget needs to have the Qt::FramelessWindowHint window flag set
for the translucency to work.
+ \li \macos: The widget needs to have the Qt::FramelessWindowHint window flag set
+ for the translucency to work.
\endlist
@@ -2303,7 +2305,7 @@ void QWidgetPrivate::deactivateWidgetCleanup()
/*!
- Returns a pointer to the widget with window identifer/handle \a
+ Returns a pointer to the widget with window identifier/handle \a
id.
The window identifier type depends on the underlying window
@@ -2958,9 +2960,9 @@ bool QWidget::isFullScreen() const
Calling this function only affects \l{isWindow()}{windows}.
- To return from full-screen mode, call showNormal().
+ To return from full-screen mode, call showNormal() or close().
- Full-screen mode works fine under Windows, but has certain
+ \note Full-screen mode works fine under Windows, but has certain
problems under X. These problems are due to limitations of the
ICCCM protocol that specifies the communication between X11
clients and the window manager. ICCCM simply does not understand
@@ -2980,7 +2982,14 @@ bool QWidget::isFullScreen() const
X11 window managers that follow modern post-ICCCM specifications
support full-screen mode properly.
- \sa showNormal(), showMaximized(), show(), hide(), isVisible()
+ On macOS, showing a window full screen puts the entire application in
+ full-screen mode, providing it with a dedicated desktop. Showing another
+ window while the application runs in full-screen mode might automatically
+ make that window full screen as well. To prevent that, exit full-screen
+ mode by calling showNormal() or by close() on the full screen window
+ before showing another window.
+
+ \sa showNormal(), showMaximized(), show(), isVisible(), close()
*/
void QWidget::showFullScreen()
{
@@ -4682,7 +4691,9 @@ void QWidgetPrivate::resolveLayoutDirection()
/*!
\property QWidget::layoutDirection
- \brief the layout direction for this widget
+ \brief the layout direction for this widget.
+
+ \note This method no longer affects text layout direction since Qt 4.7.
By default, this property is set to Qt::LeftToRight.
@@ -4693,7 +4704,6 @@ void QWidgetPrivate::resolveLayoutDirection()
has been called for the parent do not inherit the parent's layout
direction.
- This method no longer affects text layout direction since Qt 4.7.
\sa QApplication::layoutDirection
*/
@@ -5286,10 +5296,11 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
(source->d_func());
if (!sourced->context) {
- QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, repaintManager);
+ const QRegion effectRgn((flags & UseEffectRegionBounds) ? rgn.boundingRect() : rgn);
+ QWidgetPaintContext context(pdev, effectRgn, offset, flags, sharedPainter, repaintManager);
sourced->context = &context;
if (!sharedPainter) {
- setSystemClip(pdev->paintEngine(), pdev->devicePixelRatioF(), rgn.translated(offset));
+ setSystemClip(pdev->paintEngine(), pdev->devicePixelRatioF(), effectRgn.translated(offset));
QPainter p(pdev);
p.translate(offset);
context.painter = &p;
@@ -5303,7 +5314,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
}
sharedPainter->save();
sharedPainter->translate(offset);
- setSystemClip(sharedPainter->paintEngine(), sharedPainter->device()->devicePixelRatioF(), rgn.translated(offset));
+ setSystemClip(sharedPainter->paintEngine(), sharedPainter->device()->devicePixelRatioF(), effectRgn.translated(offset));
graphicsEffect->draw(sharedPainter);
setSystemClip(sharedPainter->paintEngine(), 1, QRegion());
sharedPainter->restore();
@@ -5311,12 +5322,13 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
sourced->context = nullptr;
if (repaintManager)
- repaintManager->markNeedsFlush(q, rgn, offset);
+ repaintManager->markNeedsFlush(q, effectRgn, offset);
return;
}
}
#endif // QT_CONFIG(graphicseffect)
+ flags = flags & ~UseEffectRegionBounds;
const bool alsoOnScreen = flags & DrawPaintOnScreen;
const bool recursive = flags & DrawRecursive;
@@ -6476,6 +6488,9 @@ void QWidget::clearFocus()
QCoreApplication::sendEvent(this, &focusAboutToChange);
}
+ QTLWExtra *extra = window()->d_func()->maybeTopData();
+ QObject *originalFocusObject = (extra && extra->window) ? extra->window->focusObject() : nullptr;
+
QWidget *w = this;
while (w) {
// Just like setFocus(), we update (clear) the focus_child of our parents
@@ -6484,14 +6499,12 @@ void QWidget::clearFocus()
w = w->parentWidget();
}
- // Since we've unconditionally cleared the focus_child of our parents, we need
+ // We've potentially cleared the focus_child of our parents, so we need
// to report this to the rest of Qt. Note that the focus_child is not the same
// thing as the application's focusWidget, which is why this piece of code is
- // not inside the hasFocus() block below.
- if (QTLWExtra *extra = window()->d_func()->maybeTopData()) {
- if (extra->window)
- emit extra->window->focusObjectChanged(extra->window->focusObject());
- }
+ // not inside a hasFocus() block.
+ if (originalFocusObject && originalFocusObject != extra->window->focusObject())
+ emit extra->window->focusObjectChanged(extra->window->focusObject());
#if QT_CONFIG(graphicsview)
const auto &topData = d_func()->extra;
@@ -6744,8 +6757,21 @@ void QWidget::setTabOrder(QWidget* first, QWidget *second)
lastFocusChild = target;
QWidget *focusProxy = target->d_func()->deepestFocusProxy();
- if (!focusProxy || !target->isAncestorOf(focusProxy))
+ if (!focusProxy || !target->isAncestorOf(focusProxy)) {
+ // QTBUG-81097: Another case is possible here. We can have a child
+ // widget, that sets its focusProxy() to the parent (target).
+ // An example of such widget is a QLineEdit, nested into
+ // a QAbstractSpinBox. In this case such widget should be considered
+ // the last focus child.
+ for (auto *object : target->children()) {
+ QWidget *w = qobject_cast<QWidget*>(object);
+ if (w && w->focusProxy() == target) {
+ lastFocusChild = w;
+ break;
+ }
+ }
return;
+ }
lastFocusChild = focusProxy;
@@ -11400,7 +11426,7 @@ QString QWidget::accessibleName() const
\brief the widget's description as seen by assistive technologies
The accessible description of a widget should convey what a widget does.
- While the \l accessibleName should be a short and consise string (e.g. \gui{Save}),
+ While the \l accessibleName should be a short and concise string (e.g. \gui{Save}),
the description should give more context, such as \gui{Saves the current document}.
This property has to be \l{Internationalization with Qt}{localized}.
@@ -12107,7 +12133,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
- d->aboutToDestroy();
+ d->aboutToDestroy(destroyWindow);
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBackingStore(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
@@ -12852,4 +12878,4 @@ QDebug operator<<(QDebug debug, const QWidget *widget)
QT_END_NAMESPACE
#include "moc_qwidget.cpp"
-
+#include "moc_qwidget_p.cpp"