diff options
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index cf90df6b9b..759821a057 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5246,8 +5246,6 @@ static void sendResizeEvents(QWidget *target) \sa render(), QPixmap */ - -/* INVOKABLE since used by QPixmap::grabWidget(). */ QPixmap QWidget::grab(const QRect &rectangle) { Q_D(QWidget); @@ -6593,11 +6591,6 @@ void QWidget::setFocus(Qt::FocusReason reason) } else { f->d_func()->updateFocusChild(); } - - if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) { - if (extra->window) - emit extra->window->focusObjectChanged(f); - } } void QWidgetPrivate::setFocus_sys() @@ -6632,6 +6625,11 @@ void QWidgetPrivate::updateFocusChild() w = w->isWindow() ? 0 : w->parentWidget(); } } + + if (QTLWExtra *extra = q->window()->d_func()->maybeTopData()) { + if (extra->window) + emit extra->window->focusObjectChanged(q); + } } /*! @@ -6673,9 +6671,15 @@ void QWidget::clearFocus() w->d_func()->focus_child = 0; w = w->parentWidget(); } - // Since focus_child is the basis for the top level QWidgetWindow's focusObject() - // we need to report this change to the rest of Qt, but we match setFocus() and - // do it at the end of the function. + + // Since we've unconditionally cleared the focus_child of our parents, 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()); + } #ifndef QT_NO_GRAPHICSVIEW QWExtra *topData = d_func()->extra; @@ -6698,15 +6702,6 @@ void QWidget::clearFocus() #endif } } - - // Since we've unconditionally cleared the focus_child of our parents, 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 above. - if (QTLWExtra *extra = window()->d_func()->maybeTopData()) { - if (extra->window) - emit extra->window->focusObjectChanged(extra->window->focusObject()); - } } @@ -10353,7 +10348,7 @@ void QWidget::updateGeometry() a window, causing the widget to be hidden. You must call show() to make the widget visible again.. - \sa windowType(), {Window Flags Example} + \sa windowType(), setWindowFlag(), {Window Flags Example} */ void QWidget::setWindowFlags(Qt::WindowFlags flags) { @@ -10361,6 +10356,23 @@ void QWidget::setWindowFlags(Qt::WindowFlags flags) d->setWindowFlags(flags); } +/*! + \since 5.9 + + Sets the window flag \a flag on this widget if \a on is true; + otherwise clears the flag. + + \sa setWindowFlags(), windowFlags(), windowType() +*/ +void QWidget::setWindowFlag(Qt::WindowType flag, bool on) +{ + Q_D(QWidget); + if (on) + d->setWindowFlags(data->window_flags | flag); + else + d->setWindowFlags(data->window_flags & ~flag); +} + /*! \internal Implemented in QWidgetPrivate so that QMdiSubWindowPrivate can reimplement it. @@ -12710,7 +12722,6 @@ void QWidget::activateWindow() } /*! - \fn int QWidget::metric(PaintDeviceMetric m) const Internal implementation of the virtual QPaintDevice::metric() function. @@ -12934,6 +12945,9 @@ void QWidget::setMask(const QBitmap &bitmap) */ void QWidget::clearMask() { + Q_D(QWidget); + if (!d->extra || !d->extra->hasMask) + return; setMask(QRegion()); } |