summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qaction.h2
-rw-r--r--src/widgets/kernel/qactiongroup.cpp6
-rw-r--r--src/widgets/kernel/qapplication.cpp168
-rw-r--r--src/widgets/kernel/qboxlayout.cpp22
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp2
-rw-r--r--src/widgets/kernel/qformlayout.cpp102
-rw-r--r--src/widgets/kernel/qgesture.cpp4
-rw-r--r--src/widgets/kernel/qgesture_p.h3
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp18
-rw-r--r--src/widgets/kernel/qgridlayout.cpp28
-rw-r--r--src/widgets/kernel/qlayout.cpp44
-rw-r--r--src/widgets/kernel/qlayout_p.h2
-rw-r--r--src/widgets/kernel/qlayoutengine.cpp13
-rw-r--r--src/widgets/kernel/qlayoutengine_p.h6
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp20
-rw-r--r--src/widgets/kernel/qlayoutitem.h8
-rw-r--r--src/widgets/kernel/qmacgesturerecognizer.cpp4
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp26
-rw-r--r--src/widgets/kernel/qshortcut.cpp74
-rw-r--r--src/widgets/kernel/qshortcut.h60
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp14
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp4
-rw-r--r--src/widgets/kernel/qtestsupport_widgets.h2
-rw-r--r--src/widgets/kernel/qtooltip.cpp16
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp16
-rw-r--r--src/widgets/kernel/qwidget.cpp194
-rw-r--r--src/widgets/kernel/qwidget.h12
-rw-r--r--src/widgets/kernel/qwidget_p.h4
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp8
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp16
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp6
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp34
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp10
-rw-r--r--src/widgets/kernel/qwindowcontainer_p.h2
-rw-r--r--src/widgets/kernel/win.pri1
36 files changed, 546 insertions, 407 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 19ad65692b..64b0d69f6d 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -658,7 +658,7 @@ void QAction::setMenu(QMenu *menu)
{
Q_D(QAction);
if (d->menu)
- d->menu->d_func()->setOverrideMenuAction(0); //we reset the default action of any previous menu
+ d->menu->d_func()->setOverrideMenuAction(nullptr); //we reset the default action of any previous menu
d->menu = menu;
if (menu)
menu->d_func()->setOverrideMenuAction(this);
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index f7693f4dde..258a1ea0a0 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -63,7 +63,7 @@ class Q_WIDGETS_EXPORT QAction : public QObject
Q_DECLARE_PRIVATE(QAction)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
- Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed)
Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY changed)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed)
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 1d9213de0c..5dc12c48a4 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -81,7 +81,7 @@ void QActionGroupPrivate::_q_actionChanged()
current = action;
}
} else if (action == current) {
- current = 0;
+ current = nullptr;
}
}
}
@@ -271,11 +271,11 @@ void QActionGroup::removeAction(QAction *action)
Q_D(QActionGroup);
if (d->actions.removeAll(action)) {
if (action == d->current)
- d->current = 0;
+ d->current = nullptr;
QObject::disconnect(action, SIGNAL(triggered()), this, SLOT(_q_actionTriggered()));
QObject::disconnect(action, SIGNAL(changed()), this, SLOT(_q_actionChanged()));
QObject::disconnect(action, SIGNAL(hovered()), this, SLOT(_q_actionHovered()));
- action->d_func()->group = 0;
+ action->d_func()->group = nullptr;
}
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 5a21a3a15c..3577414713 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT void qt_call_post_routines();
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1);
-QApplicationPrivate *QApplicationPrivate::self = 0;
+QApplicationPrivate *QApplicationPrivate::self = nullptr;
static void initSystemPalette()
{
@@ -161,7 +161,7 @@ static void initSystemPalette()
static void clearSystemPalette()
{
delete QApplicationPrivate::sys_pal;
- QApplicationPrivate::sys_pal = 0;
+ QApplicationPrivate::sys_pal = nullptr;
}
bool QApplicationPrivate::autoSipEnabled = true;
@@ -172,8 +172,8 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
application_type = QApplicationPrivate::Gui;
#ifndef QT_NO_GESTURES
- gestureManager = 0;
- gestureWidget = 0;
+ gestureManager = nullptr;
+ gestureWidget = nullptr;
#endif // QT_NO_GESTURES
if (!self)
@@ -183,7 +183,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
QApplicationPrivate::~QApplicationPrivate()
{
if (self == this)
- self = 0;
+ self = nullptr;
}
void QApplicationPrivate::createEventDispatcher()
@@ -360,7 +360,7 @@ QWidget *QApplication::topLevelAt(const QPoint &pos)
if (const QWidgetWindow *widgetWindow = qobject_cast<const QWidgetWindow *>(window))
return widgetWindow->widget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -375,21 +375,21 @@ QWidget *QApplication::topLevelAt(const QPoint &pos)
void qt_init_tooltip_palette();
void qt_cleanup();
-QStyle *QApplicationPrivate::app_style = 0; // default application style
+QStyle *QApplicationPrivate::app_style = nullptr; // default application style
#ifndef QT_NO_STYLE_STYLESHEET
QString QApplicationPrivate::styleSheet; // default application stylesheet
#endif
-QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
+QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = nullptr;
-QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
+QPalette *QApplicationPrivate::sys_pal = nullptr; // default system palette
-QFont *QApplicationPrivate::sys_font = 0; // default system font
-QFont *QApplicationPrivate::set_font = 0; // default font set by programmer
+QFont *QApplicationPrivate::sys_font = nullptr; // default system font
+QFont *QApplicationPrivate::set_font = nullptr; // default font set by programmer
-QWidget *QApplicationPrivate::main_widget = 0; // main application widget
-QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus
-QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show()
-QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus
+QWidget *QApplicationPrivate::main_widget = nullptr; // main application widget
+QWidget *QApplicationPrivate::focus_widget = nullptr; // has keyboard input focus
+QWidget *QApplicationPrivate::hidden_focus_widget = nullptr; // will get keyboard input focus after show()
+QWidget *QApplicationPrivate::active_window = nullptr; // toplevel with keyboard focus
#if QT_CONFIG(wheelevent)
QPointer<QWidget> QApplicationPrivate::wheel_widget;
#endif
@@ -421,9 +421,9 @@ Q_GLOBAL_STATIC(FontHash, app_fonts)
PaletteHash *qt_app_palettes_hash() { return app_palettes(); }
FontHash *qt_app_fonts_hash() { return app_fonts(); }
-QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus
+QWidgetList *QApplicationPrivate::popupWidgets = nullptr; // has keyboard input focus
-QDesktopWidget *qt_desktopWidget = 0; // root window widgets
+QDesktopWidget *qt_desktopWidget = nullptr; // root window widgets
/*!
\internal
@@ -468,7 +468,7 @@ void QApplicationPrivate::process_cmdline()
}
if(j < argc) {
- argv[j] = 0;
+ argv[j] = nullptr;
argc = j;
}
}
@@ -633,7 +633,7 @@ void QApplicationPrivate::initialize()
static void setPossiblePalette(const QPalette *palette, const char *className)
{
- if (palette == 0)
+ if (palette == nullptr)
return;
QApplicationPrivate::setPalette_helper(*palette, className, false);
}
@@ -759,7 +759,7 @@ QWidget *QApplication::activePopupWidget()
QWidget *QApplication::activeModalWidget()
{
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(modalWindow());
- return widgetWindow ? widgetWindow->widget() : 0;
+ return widgetWindow ? widgetWindow->widget() : nullptr;
}
/*!
@@ -782,12 +782,12 @@ QApplication::~QApplication()
QApplicationPrivate::is_app_running = false;
delete QWidgetPrivate::mapper;
- QWidgetPrivate::mapper = 0;
+ QWidgetPrivate::mapper = nullptr;
// delete all widgets
if (QWidgetPrivate::allWidgets) {
QWidgetSet *mySet = QWidgetPrivate::allWidgets;
- QWidgetPrivate::allWidgets = 0;
+ QWidgetPrivate::allWidgets = nullptr;
for (QWidgetSet::ConstIterator it = mySet->constBegin(), cend = mySet->constEnd(); it != cend; ++it) {
QWidget *w = *it;
if (!w->parent()) // window
@@ -797,21 +797,21 @@ QApplication::~QApplication()
}
delete qt_desktopWidget;
- qt_desktopWidget = 0;
+ qt_desktopWidget = nullptr;
delete QApplicationPrivate::app_pal;
- QApplicationPrivate::app_pal = 0;
+ QApplicationPrivate::app_pal = nullptr;
clearSystemPalette();
app_palettes()->clear();
delete QApplicationPrivate::sys_font;
- QApplicationPrivate::sys_font = 0;
+ QApplicationPrivate::sys_font = nullptr;
delete QApplicationPrivate::set_font;
- QApplicationPrivate::set_font = 0;
+ QApplicationPrivate::set_font = nullptr;
app_fonts()->clear();
delete QApplicationPrivate::app_style;
- QApplicationPrivate::app_style = 0;
+ QApplicationPrivate::app_style = nullptr;
#if QT_CONFIG(draganddrop)
if (qt_is_gui_used)
@@ -857,7 +857,7 @@ void qt_cleanup()
QPixmapCache::clear();
QColormap::cleanup();
- QApplicationPrivate::active_window = 0; //### this should not be necessary
+ QApplicationPrivate::active_window = nullptr; //### this should not be necessary
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
if (displayDC) {
@@ -903,7 +903,7 @@ QWidget *QApplication::widgetAt(const QPoint &p)
QRegion newmask = (oldmask.isEmpty() ? QRegion(window->rect()) : oldmask)
- QRegion(wpoint.x(), wpoint.y(), 1, 1);
window->setMask(newmask);
- QWidget *recurse = 0;
+ QWidget *recurse = nullptr;
if (QApplication::topLevelAt(p) != window) // verify recursion will terminate
recurse = widgetAt(x, y);
if (oldmask.isEmpty())
@@ -936,7 +936,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::LanguageChange)) {
for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
const QPostEvent &cur = *it;
- if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type())
+ if (cur.receiver != receiver || cur.event == nullptr || cur.event->type() != event->type())
continue;
if (cur.event->type() == QEvent::LayoutRequest
|| cur.event->type() == QEvent::UpdateRequest) {
@@ -1046,7 +1046,7 @@ QStyle *QApplication::style()
}
if (!defaultStyle) {
Q_ASSERT(!"No styles available!");
- return 0;
+ return nullptr;
}
// Take ownership of the style
@@ -1207,7 +1207,7 @@ QStyle* QApplication::setStyle(const QString& style)
{
QStyle *s = QStyleFactory::create(style);
if (!s)
- return 0;
+ return nullptr;
setStyle(s);
return s;
@@ -1697,7 +1697,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
return;
#endif
- hidden_focus_widget = 0;
+ hidden_focus_widget = nullptr;
if (focus != focus_widget) {
if (focus && focus->isHidden()) {
@@ -1895,7 +1895,7 @@ bool QApplication::event(QEvent *e)
#endif
} else if (e->type() == QEvent::Timer) {
QTimerEvent *te = static_cast<QTimerEvent*>(e);
- Q_ASSERT(te != 0);
+ Q_ASSERT(te != nullptr);
if (te->timerId() == d->toolTipWakeUp.timerId()) {
d->toolTipWakeUp.stop();
if (d->toolTipWidget) {
@@ -1907,14 +1907,14 @@ bool QApplication::event(QEvent *e)
while (w && !showToolTip) {
showToolTip = w->isActiveWindow();
w = w->parentWidget();
- w = w ? w->window() : 0;
+ w = w ? w->window() : nullptr;
}
if (showToolTip) {
QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos);
QCoreApplication::sendEvent(d->toolTipWidget, &e);
if (e.isAccepted()) {
QStyle *s = d->toolTipWidget->style();
- int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, 0, d->toolTipWidget, 0);
+ int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, nullptr, d->toolTipWidget, nullptr);
d->toolTipFallAsleep.start(sleepDelay, this);
}
}
@@ -1984,7 +1984,7 @@ void QApplicationPrivate::notifyLayoutDirectionChange()
*/
void QApplication::setActiveWindow(QWidget* act)
{
- QWidget* window = act?act->window():0;
+ QWidget* window = act?act->window():nullptr;
if (QApplicationPrivate::active_window == window)
return;
@@ -2000,7 +2000,7 @@ void QApplication::setActiveWindow(QWidget* act)
QWidgetList toBeDeactivated;
if (QApplicationPrivate::active_window) {
- if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) {
+ if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
const QWidgetList list = topLevelWidgets();
for (auto *w : list) {
if (w->isVisible() && w->isActiveWindow())
@@ -2022,7 +2022,7 @@ void QApplication::setActiveWindow(QWidget* act)
QApplicationPrivate::active_window = window;
if (QApplicationPrivate::active_window) {
- if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) {
+ if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
const QWidgetList list = topLevelWidgets();
for (auto *w : list) {
if (w->isVisible() && w->isActiveWindow())
@@ -2051,10 +2051,10 @@ void QApplication::setActiveWindow(QWidget* act)
sendSpontaneousEvent(w, &activationChange);
}
- if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode()
+ if (QApplicationPrivate::popupWidgets == nullptr) { // !inPopupMode()
// then focus events
if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) {
- QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
+ QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason);
} else if (QApplicationPrivate::active_window) {
QWidget *w = QApplicationPrivate::active_window->focusWidget();
if (w && w->isVisible() /*&& w->focusPolicy() != QWidget::NoFocus*/)
@@ -2069,7 +2069,7 @@ void QApplication::setActiveWindow(QWidget* act)
if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus)
QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason);
else if (!QApplicationPrivate::active_window->isAncestorOf(w))
- QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
+ QApplicationPrivate::setFocusWidget(nullptr, Qt::ActiveWindowFocusReason);
}
}
}
@@ -2097,7 +2097,7 @@ QWidget *qt_tlw_for_window(QWindow *wnd)
return tlw;
}
}
- return 0;
+ return nullptr;
}
void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
@@ -2160,7 +2160,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
test = test->d_func()->focus_next;
}
- if (wrappingOccurred != 0)
+ if (wrappingOccurred != nullptr)
*wrappingOccurred = next ? focusWidgetAfterWindow : !focusWidgetAfterWindow;
if (w == f) {
@@ -2168,7 +2168,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
w->window()->setAttribute(Qt::WA_KeyboardFocusChange);
w->update();
}
- return 0;
+ return nullptr;
}
return w;
}
@@ -2250,7 +2250,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
QEvent leaveEvent(QEvent::Leave);
for (int i = 0; i < leaveList.size(); ++i) {
auto *w = leaveList.at(i);
- if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
+ if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, nullptr)) {
QCoreApplication::sendEvent(w, &leaveEvent);
if (w->testAttribute(Qt::WA_Hover) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
@@ -2269,7 +2269,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
const QPoint windowPos = qAsConst(enterList).back()->window()->mapFromGlobal(globalPos);
for (auto it = enterList.crbegin(), end = enterList.crend(); it != end; ++it) {
auto *w = *it;
- if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
+ if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, nullptr)) {
const QPointF localPos = w->mapFromGlobal(globalPos);
QEnterEvent enterEvent(localPos, windowPos, globalPosF);
QCoreApplication::sendEvent(w, &enterEvent);
@@ -2289,7 +2289,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen)));
// Whenever we leave an alien widget on X11/QPA, we need to reset its nativeParentWidget()'s cursor.
// This is not required on Windows as the cursor is reset on every single mouse move.
- QWidget *parentOfLeavingCursor = 0;
+ QWidget *parentOfLeavingCursor = nullptr;
for (int i = 0; i < leaveList.size(); ++i) {
auto *w = leaveList.at(i);
if (!isAlien(w))
@@ -2355,7 +2355,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const
{
- QWindow *unused = 0;
+ QWindow *unused = nullptr;
if (Q_UNLIKELY(!window)) {
qWarning().nospace() << "window == 0 passed.";
return false;
@@ -2364,13 +2364,13 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
blockingWindow = &unused;
if (modalWindowList.isEmpty()) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
QWidget *popupWidget = QApplication::activePopupWidget();
- QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0;
+ QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : nullptr;
if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -2380,7 +2380,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
// A window is not blocked by another modal window if the two are
// the same, or if the window is a child of the modal window.
if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients)) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -2391,7 +2391,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
// modalWindow's widget, this normally happens when waiting for a
// native dialog. use WindowModal if we are the child of a group
// leader; otherwise use ApplicationModal.
- QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0;
+ QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : nullptr;
while (m && !m->testAttribute(Qt::WA_GroupLeader)) {
m = m->parentWidget();
if (m)
@@ -2406,13 +2406,13 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
case Qt::ApplicationModal:
{
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(window);
- QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : 0;
+ QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : nullptr;
while (groupLeaderForWidget && !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader))
groupLeaderForWidget = groupLeaderForWidget->parentWidget();
if (groupLeaderForWidget) {
// if \a widget has WA_GroupLeader, it can only be blocked by ApplicationModal children
- QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0;
+ QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : nullptr;
while (m && m != groupLeaderForWidget && !m->testAttribute(Qt::WA_GroupLeader))
m = m->parentWidget();
if (m == groupLeaderForWidget) {
@@ -2452,7 +2452,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
break;
}
}
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -2476,7 +2476,7 @@ bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop)
bool qt_try_modal(QWidget *widget, QEvent::Type type)
{
- QWidget * top = 0;
+ QWidget * top = nullptr;
if (QApplicationPrivate::tryModalHelper(widget, &top))
return true;
@@ -2501,7 +2501,7 @@ bool qt_try_modal(QWidget *widget, QEvent::Type type)
break;
}
- if (block_event && top && top->parentWidget() == 0)
+ if (block_event && top && top->parentWidget() == nullptr)
top->raise();
return !block_event;
@@ -2525,11 +2525,11 @@ QWidget *QApplicationPrivate::pickMouseReceiver(QWidget *candidate, const QPoint
QWidget *mouseGrabber = QWidget::mouseGrabber();
if (((type == QEvent::MouseMove && buttons) || (type == QEvent::MouseButtonRelease))
&& !buttonDown && !mouseGrabber) {
- return 0;
+ return nullptr;
}
if (alienWidget && alienWidget->internalWinId())
- alienWidget = 0;
+ alienWidget = nullptr;
QWidget *receiver = candidate;
@@ -2562,7 +2562,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
Q_ASSERT(buttonDown);
if (alienWidget && !isAlien(alienWidget))
- alienWidget = 0;
+ alienWidget = nullptr;
QPointer<QWidget> receiverGuard = receiver;
QPointer<QWidget> nativeGuard = nativeWidget;
@@ -2577,7 +2577,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
// leaveAfterRelease has not been updated.
// This happens e.g. when modal dialog or popup is shown as a response to button click.
if (leaveAfterRelease && !*buttonDown && !event->buttons())
- leaveAfterRelease = 0;
+ leaveAfterRelease = nullptr;
if (*buttonDown) {
if (!graphicsWidget) {
@@ -2586,7 +2586,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
if ((alienWidget || !receiver->internalWinId()) && !leaveAfterRelease && !QWidget::mouseGrabber())
leaveAfterRelease = *buttonDown;
if (event->type() == QEvent::MouseButtonRelease && !event->buttons())
- *buttonDown = 0;
+ *buttonDown = nullptr;
}
} else if (lastMouseReceiver && widgetUnderMouse) {
// Dispatch enter/leave if we move:
@@ -2614,7 +2614,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
// We need this quard in case someone opens a modal dialog / popup. If that's the case
// leaveAfterRelease is set to null, but we shall not update lastMouseReceiver.
- const bool wasLeaveAfterRelease = leaveAfterRelease != 0;
+ const bool wasLeaveAfterRelease = leaveAfterRelease != nullptr;
bool result = true;
// This code is used for sending the synthetic enter/leave events for cases where it is needed
// due to other events causing the widget under the mouse to change. However in those cases
@@ -2632,18 +2632,18 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
// Dispatch enter/leave if:
// 1) the mouse grabber is an alien widget
// 2) the button is released on an alien widget
- QWidget *enter = 0;
+ QWidget *enter = nullptr;
if (nativeGuard)
enter = alienGuard ? alienWidget : nativeWidget;
else // The receiver is typically deleted on mouse release with drag'n'drop.
enter = QApplication::widgetAt(event->globalPos());
dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos());
- leaveAfterRelease = 0;
+ leaveAfterRelease = nullptr;
lastMouseReceiver = enter;
} else if (!wasLeaveAfterRelease) {
if (activePopupWidget) {
if (!QWidget::mouseGrabber())
- lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0);
+ lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : nullptr);
} else {
lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPos());
}
@@ -2698,7 +2698,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
return; // Mouse cursor not inside the widget or any of its children.
if (widget->data->in_destructor && qt_button_down == widget)
- qt_button_down = 0;
+ qt_button_down = nullptr;
// A mouse move is not actually sent, but we utilize the sendMouseEvent() call to send the
// enter/leave events as appropriate
@@ -3050,9 +3050,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
key->accept();
else
key->ignore();
- QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0;
+ QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : nullptr;
#if QT_CONFIG(graphicsview)
- QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0;
+ QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : nullptr;
#endif
res = d->notify_helper(receiver, e);
@@ -3114,7 +3114,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->toolTipPos = relpos;
d->toolTipGlobalPos = mouse->globalPos();
QStyle *s = d->toolTipWidget->style();
- int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, 0, d->toolTipWidget, 0);
+ int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, nullptr, d->toolTipWidget, nullptr);
d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive() ? 20 : wakeDelay, this);
}
}
@@ -3444,7 +3444,7 @@ QT_WARNING_POP
&& !isProxyWidget
#endif
)
- QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop);
+ QDragManager::self()->setCurrentTarget(nullptr, e->type() == QEvent::Drop);
}
break;
#endif
@@ -3475,7 +3475,7 @@ QT_WARNING_POP
eventAccepted = touchEvent->isAccepted();
if (p.isNull()) {
// widget was deleted
- widget = 0;
+ widget = nullptr;
} else {
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted);
}
@@ -3662,7 +3662,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
// send to all application event filters
if (threadRequiresCoreApplication()
- && receiver->d_func()->threadData->thread.loadAcquire() == mainThread()
+ && receiver->d_func()->threadData.loadRelaxed()->thread.loadAcquire() == mainThread()
&& sendThroughApplicationEventFilters(receiver, e)) {
filtered = true;
return filtered;
@@ -3700,7 +3700,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
bool QApplicationPrivate::inPopupMode()
{
- return QApplicationPrivate::popupWidgets != 0;
+ return QApplicationPrivate::popupWidgets != nullptr;
}
static void ungrabKeyboardForPopup(QWidget *popup)
@@ -3744,13 +3744,13 @@ void QApplicationPrivate::closePopup(QWidget *popup)
popupWidgets->removeAll(popup);
if (popup == qt_popup_down) {
- qt_button_down = 0;
- qt_popup_down = 0;
+ qt_button_down = nullptr;
+ qt_popup_down = nullptr;
}
if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup
delete QApplicationPrivate::popupWidgets;
- QApplicationPrivate::popupWidgets = 0;
+ QApplicationPrivate::popupWidgets = nullptr;
if (popupGrabOk) {
popupGrabOk = false;
@@ -4118,7 +4118,7 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven
{
const bool setFocusOnRelease = QGuiApplication::styleHints()->setFocusOnTouchRelease();
Qt::FocusPolicy focusPolicy = Qt::ClickFocus;
- static QPointer<QWidget> focusedWidgetOnTouchBegin = 0;
+ static QPointer<QWidget> focusedWidgetOnTouchBegin = nullptr;
switch (event->type()) {
case QEvent::MouseButtonPress:
@@ -4225,7 +4225,7 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device,
{
const QPointF screenPos = touchPoint.screenPos();
int closestTouchPointId = -1;
- QObject *closestTarget = 0;
+ QObject *closestTarget = nullptr;
qreal closestDistance = qreal(0.);
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(),
ite = activeTouchPoints.constEnd();
@@ -4311,7 +4311,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
if (!target)
continue;
}
- Q_ASSERT(target.data() != 0);
+ Q_ASSERT(target.data() != nullptr);
QWidget *targetWidget = static_cast<QWidget *>(target.data());
@@ -4337,7 +4337,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();
for (; it != end; ++it) {
const QPointer<QWidget> widget = it.key();
- if (!QApplicationPrivate::tryModalHelper(widget, 0))
+ if (!QApplicationPrivate::tryModalHelper(widget, nullptr))
continue;
QEvent::Type eventType;
@@ -4464,7 +4464,7 @@ QGestureManager* QGestureManager::instance(InstanceCreation ic)
{
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
if (!qAppPriv)
- return 0;
+ return nullptr;
if (!qAppPriv->gestureManager && ic == ForceCreation)
qAppPriv->gestureManager = new QGestureManager(qApp);
return qAppPriv->gestureManager;
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index 76d8533271..7b09adfbf0 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -278,7 +278,7 @@ void QBoxLayoutPrivate::setupGeom()
int fixedSpacing = q->spacing();
int previousNonEmptyIndex = -1;
- QStyle *style = 0;
+ QStyle *style = nullptr;
if (fixedSpacing < 0) {
if (QWidget *parentWidget = q->parentWidget())
style = parentWidget->style();
@@ -318,7 +318,7 @@ void QBoxLayoutPrivate::setupGeom()
if (style) {
spacing = style->combinedLayoutSpacing(actual1, actual2,
horz(dir) ? Qt::Horizontal : Qt::Vertical,
- 0, q->parentWidget());
+ nullptr, q->parentWidget());
if (spacing < 0)
spacing = 0;
}
@@ -433,10 +433,10 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item)
{
Q_Q(QBoxLayout);
if (!item)
- return 0;
+ return nullptr;
QBoxLayoutItem *b = list.value(index);
if (!b)
- return 0;
+ return nullptr;
QLayoutItem *r = b->item;
b->item = item;
@@ -551,7 +551,7 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item)
\sa direction()
*/
QBoxLayout::QBoxLayout(Direction dir, QWidget *parent)
- : QLayout(*new QBoxLayoutPrivate, 0, parent)
+ : QLayout(*new QBoxLayoutPrivate, nullptr, parent)
{
Q_D(QBoxLayout);
d->dir = dir;
@@ -684,7 +684,7 @@ int QBoxLayout::minimumHeightForWidth(int w) const
Q_D(const QBoxLayout);
(void) heightForWidth(w);
int top, bottom;
- d->effectiveMargins(0, &top, 0, &bottom);
+ d->effectiveMargins(nullptr, &top, nullptr, &bottom);
return d->hasHfw ? (d->hfwMinHeight + top + bottom) : -1;
}
@@ -713,7 +713,7 @@ int QBoxLayout::count() const
QLayoutItem *QBoxLayout::itemAt(int index) const
{
Q_D(const QBoxLayout);
- return index >= 0 && index < d->list.count() ? d->list.at(index)->item : 0;
+ return index >= 0 && index < d->list.count() ? d->list.at(index)->item : nullptr;
}
/*!
@@ -723,16 +723,16 @@ QLayoutItem *QBoxLayout::takeAt(int index)
{
Q_D(QBoxLayout);
if (index < 0 || index >= d->list.count())
- return 0;
+ return nullptr;
QBoxLayoutItem *b = d->list.takeAt(index);
QLayoutItem *item = b->item;
- b->item = 0;
+ b->item = nullptr;
delete b;
if (QLayout *l = item->layout()) {
// sanity check in case the user passed something weird to QObject::setParent()
if (l->parent() == this)
- l->setParent(0);
+ l->setParent(nullptr);
}
invalidate();
@@ -1173,7 +1173,7 @@ void QBoxLayout::setDirection(Direction direction)
if (box->magic) {
QSpacerItem *sp = box->item->spacerItem();
if (sp) {
- if (sp->expandingDirections() == Qt::Orientations(0) /*No Direction*/) {
+ if (sp->expandingDirections() == Qt::Orientations{} /*No Direction*/) {
//spacing or strut
QSize s = sp->sizeHint();
sp->changeSize(s.height(), s.width(),
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 9e90adec46..9f98af86e3 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -205,7 +205,7 @@ QT_WARNING_POP
}
QDesktopWidget::QDesktopWidget()
- : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop)
+ : QWidget(*new QDesktopWidgetPrivate, nullptr, Qt::Desktop)
{
Q_D(QDesktopWidget);
setObjectName(QLatin1String("desktop"));
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 6f7527c013..4ffa226d7f 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -199,18 +199,17 @@ public:
ItemMatrix m_matrix;
QList<QFormLayoutItem *> m_things;
- int layoutWidth; // the last width that we called setupVerticalLayoutData on (for vLayouts)
+ int layoutWidth = -1; // the last width that we called setupVerticalLayoutData on (for vLayouts)
- int hfw_width; // the last width we calculated HFW for
- int hfw_height; // what that height was
- int hfw_minheight; // what that minheight was
+ int hfw_width = -1; // the last width we calculated HFW for
+ int hfw_height = -1; // what that height was
- int hfw_sh_height; // the hfw for sh_width
- int hfw_sh_minheight; // the minhfw for sh_width
+ int hfw_sh_height = -1; // the hfw for sh_width
+ int hfw_sh_minheight = -1; // the minhfw for sh_width
- int min_width; // the width that gets turned into minSize (from updateSizes)
- int sh_width; // the width that gets turned into prefSize (from updateSizes)
- int thresh_width; // the width that we start splitting label/field pairs at (from updateSizes)
+ int min_width = -1; // the width that gets turned into minSize (from updateSizes)
+ int sh_width = -1; // the width that gets turned into prefSize (from updateSizes)
+ int thresh_width = QLAYOUTSIZE_MAX; // the width that we start splitting label/field pairs at (from updateSizes)
QSize minSize;
QSize prefSize;
int formMaxWidth;
@@ -222,17 +221,15 @@ public:
QVector<QLayoutStruct> hfwLayouts;
- int hSpacing;
- int vSpacing;
+ int hSpacing = -1;
+ int vSpacing = -1;
QLayoutItem* replaceAt(int index, QLayoutItem*) override;
};
QFormLayoutPrivate::QFormLayoutPrivate()
: fieldGrowthPolicy(DefaultFieldGrowthPolicy),
rowWrapPolicy(DefaultRowWrapPolicy), has_hfw(false), dirty(true), sizesDirty(true),
- expandVertical(0), expandHorizontal(0), labelAlignment(0), formAlignment(0),
- layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1),
- sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1)
+ expandVertical(0), expandHorizontal(0)
{
}
@@ -298,11 +295,11 @@ void QFormLayoutPrivate::updateSizes()
bool expandH = false;
bool expandV = false;
- QFormLayoutItem *prevLbl = 0;
- QFormLayoutItem *prevFld = 0;
+ QFormLayoutItem *prevLbl = nullptr;
+ QFormLayoutItem *prevFld = nullptr;
QWidget *parent = q->parentWidget();
- QStyle *style = parent ? parent->style() : 0;
+ QStyle *style = parent ? parent->style() : nullptr;
int userVSpacing = q->verticalSpacing();
int userHSpacing = wrapAllRows ? 0 : q->horizontalSpacing();
@@ -367,9 +364,9 @@ void QFormLayoutPrivate::updateSizes()
QSizePolicy::ControlTypes fldtoptypes =
QSizePolicy::ControlTypes(fldtop ? fldtop->controlTypes() : QSizePolicy::DefaultType);
if (label && lbltop)
- label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent);
+ label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent);
if (field && fldtop)
- field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent);
+ field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent);
} else {
// Side by side.. we have to also consider the spacings to empty cells, which can strangely be more than
// non empty cells..
@@ -383,21 +380,21 @@ void QFormLayoutPrivate::updateSizes()
// To be compatible to QGridLayout, we have to compare solitary labels & fields with both predecessors
if (label) {
if (!field) {
- int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent);
- int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, 0, parent);
+ int lblspacing = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent);
+ int fldspacing = style->combinedLayoutSpacing(fldtoptypes, lbltypes, Qt::Vertical, nullptr, parent);
label->vSpace = qMax(lblspacing, fldspacing);
} else
- label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, 0, parent);
+ label->vSpace = style->combinedLayoutSpacing(lbltoptypes, lbltypes, Qt::Vertical, nullptr, parent);
}
if (field) {
// check spacing against both the previous label and field
if (!label) {
- int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, 0, parent);
- int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent);
+ int lblspacing = style->combinedLayoutSpacing(lbltoptypes, fldtypes, Qt::Vertical, nullptr, parent);
+ int fldspacing = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent);
field->vSpace = qMax(lblspacing, fldspacing);
} else
- field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, 0, parent);
+ field->vSpace = style->combinedLayoutSpacing(fldtoptypes, fldtypes, Qt::Vertical, nullptr, parent);
}
}
}
@@ -406,7 +403,7 @@ void QFormLayoutPrivate::updateSizes()
// hard-coded the left and right control types so that all the rows have the same
// inter-column spacing (otherwise the right column isn't always left aligned)
if (userHSpacing < 0 && !wrapAllRows && (label || !field->fullRow) && field)
- field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, 0, parent);
+ field->sbsHSpace = style->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, nullptr, parent);
}
// Now update our min/sizehint widths
@@ -481,7 +478,6 @@ void QFormLayoutPrivate::recalcHFW(int w)
} else {
hfw_width = w;
hfw_height = qMin(QLAYOUTSIZE_MAX, h);
- hfw_minheight = qMin(QLAYOUTSIZE_MAX, mh);
}
}
@@ -598,13 +594,13 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing
QSizePolicy::ControlTypes(item1 ? item1->controlTypes() : QSizePolicy::DefaultType);
int spacing2 = 0;
- spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, 0, parent);
+ spacing = style->combinedLayoutSpacing(itemtypes, prevItem1->controlTypes(), Qt::Vertical, nullptr, parent);
// At most of one of item2 and prevItem2 will be nonnull
if (item2)
- spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, 0, parent);
+ spacing2 = style->combinedLayoutSpacing(item2->controlTypes(), prevItem1->controlTypes(), Qt::Vertical, nullptr, parent);
else if (prevItem2)
- spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, 0, parent);
+ spacing2 = style->combinedLayoutSpacing(itemtypes, prevItem2->controlTypes(), Qt::Vertical, nullptr, parent);
spacing = qMax(spacing, spacing2);
}
@@ -652,7 +648,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
vLayouts.clear();
vLayouts.resize((2 * rr) + 2); // a max, some may be unused
- QStyle *style = 0;
+ QStyle *style = nullptr;
int userVSpacing = q->verticalSpacing();
@@ -680,8 +676,8 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
maxLabelWidth = width;
}
- QFormLayoutItem *prevItem1 = 0;
- QFormLayoutItem *prevItem2 = 0;
+ QFormLayoutItem *prevItem1 = nullptr;
+ QFormLayoutItem *prevItem2 = nullptr;
bool prevRowSplit = false;
for (int i = 0; i < rr; ++i) {
@@ -715,13 +711,13 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
initLayoutStruct(vLayouts[vidx], label);
if (vidx > 1)
- vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, 0, prevItem1, prevItem2);
+ vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, label, nullptr, prevItem1, prevItem2);
label->vLayoutIndex = vidx;
label->sideBySide = false;
prevItem1 = label;
- prevItem2 = 0;
+ prevItem2 = nullptr;
if (vLayouts[vidx].stretch > 0)
addTopBottomStretch = false;
@@ -733,13 +729,13 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
initLayoutStruct(vLayouts[vidx], field);
if (vidx > 1)
- vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, 0, prevItem1, prevItem2);
+ vLayouts[vidx - 1].spacing = spacingHelper(q->parentWidget(), style, userVSpacing, splitSideBySide || prevRowSplit, field, nullptr, prevItem1, prevItem2);
field->vLayoutIndex = vidx;
field->sideBySide = false;
prevItem1 = field;
- prevItem2 = 0;
+ prevItem2 = nullptr;
if (vLayouts[vidx].stretch > 0)
addTopBottomStretch = false;
@@ -762,7 +758,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
if (label->expandingDirections() & Qt::Vertical)
expanding = true;
- label->sideBySide = (field != 0);
+ label->sideBySide = (field != nullptr);
label->vLayoutIndex = vidx;
stretch1 = label->vStretch();
}
@@ -794,7 +790,7 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
prevItem2 = field;
} else {
prevItem1 = field;
- prevItem2 = 0;
+ prevItem2 = nullptr;
}
prevRowSplit = false;
@@ -995,12 +991,12 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
{
Q_Q(QFormLayout);
if (!newitem)
- return 0;
+ return nullptr;
const int storageIndex = storageIndexFromLayoutItem(m_matrix, m_things.value(index));
if (Q_UNLIKELY(storageIndex == -1)) {
// ### Qt6 - fix warning too when this class becomes public
qWarning("QFormLayoutPrivate::replaceAt: Invalid index %d", index);
- return 0;
+ return nullptr;
}
int row, col;
@@ -1196,7 +1192,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
\sa QWidget::setLayout()
*/
QFormLayout::QFormLayout(QWidget *parent)
- : QLayout(*new QFormLayoutPrivate, 0, parent)
+ : QLayout(*new QFormLayoutPrivate, nullptr, parent)
{
}
@@ -1332,7 +1328,7 @@ void QFormLayout::insertRow(int row, const QString &labelText, QWidget *field)
if (field && !d->checkWidget(field))
return;
- QLabel *label = 0;
+ QLabel *label = nullptr;
if (!labelText.isEmpty()) {
label = new QLabel(labelText);
#ifndef QT_NO_SHORTCUT
@@ -1354,7 +1350,7 @@ void QFormLayout::insertRow(int row, const QString &labelText, QLayout *field)
if (field && !d->checkLayout(field))
return;
- insertRow(row, labelText.isEmpty() ? 0 : new QLabel(labelText), field);
+ insertRow(row, labelText.isEmpty() ? nullptr : new QLabel(labelText), field);
}
/*!
@@ -1657,7 +1653,7 @@ QLayoutItem *QFormLayout::itemAt(int index) const
Q_D(const QFormLayout);
if (QFormLayoutItem *formItem = d->m_things.value(index))
return formItem->item;
- return 0;
+ return nullptr;
}
/*!
@@ -1670,7 +1666,7 @@ QLayoutItem *QFormLayout::takeAt(int index)
const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(index));
if (Q_UNLIKELY(storageIndex == -1)) {
qWarning("QFormLayout::takeAt: Invalid index %d", index);
- return 0;
+ return nullptr;
}
int row, col;
@@ -1696,7 +1692,7 @@ Qt::Orientations QFormLayout::expandingDirections() const
QFormLayoutPrivate *e = const_cast<QFormLayoutPrivate *>(d);
e->updateSizes();
- Qt::Orientations o = 0;
+ Qt::Orientations o;
if (e->expandHorizontal)
o = Qt::Horizontal;
if (e->expandVertical)
@@ -1835,7 +1831,7 @@ QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const
{
Q_D(const QFormLayout);
if (uint(row) >= uint(d->m_matrix.rowCount()))
- return 0;
+ return nullptr;
switch (role) {
case SpanningRole:
if (QFormLayoutItem *item = d->m_matrix(row, 1))
@@ -1848,7 +1844,7 @@ QLayoutItem *QFormLayout::itemAt(int row, ItemRole role) const
return item->item;
break;
}
- return 0;
+ return nullptr;
}
/*!
@@ -1932,7 +1928,7 @@ QWidget *QFormLayout::labelForField(QWidget *field) const
if (QFormLayoutItem *label = d->m_matrix(row, LabelRole))
return label->widget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -1951,7 +1947,7 @@ QWidget *QFormLayout::labelForField(QLayout *field) const
if (QFormLayoutItem *label = d->m_matrix(row, LabelRole))
return label->widget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2326,7 +2322,7 @@ void QFormLayout::resetRowWrapPolicy()
void QFormLayout::resetFormAlignment()
{
Q_D(QFormLayout);
- d->formAlignment = 0;
+ d->formAlignment = { };
}
/*!
@@ -2336,7 +2332,7 @@ void QFormLayout::resetFormAlignment()
void QFormLayout::resetLabelAlignment()
{
Q_D(QFormLayout);
- d->labelAlignment = 0;
+ d->labelAlignment = { };
}
#if 0
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index fc715687c6..84dbed7043 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -879,7 +879,7 @@ int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
Creates new QGestureEvent containing a list of \a gestures.
*/
QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
- : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(0)
+ : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(nullptr)
{
}
@@ -907,7 +907,7 @@ QGesture *QGestureEvent::gesture(Qt::GestureType type) const
for (int i = 0; i < m_gestures.size(); ++i)
if (m_gestures.at(i)->gestureType() == type)
return m_gestures.at(i);
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h
index cbf8d60892..057302bda1 100644
--- a/src/widgets/kernel/qgesture_p.h
+++ b/src/widgets/kernel/qgesture_p.h
@@ -111,8 +111,7 @@ class QPinchGesturePrivate : public QGesturePrivate
public:
QPinchGesturePrivate()
- : totalChangeFlags(nullptr), changeFlags(nullptr),
- totalScaleFactor(1), lastScaleFactor(1), scaleFactor(1),
+ : totalScaleFactor(1), lastScaleFactor(1), scaleFactor(1),
totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0),
isNewSequence(true)
{
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index d0c6b882b5..5604391059 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -188,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
// from the destructor.
if (object->isWidgetType()) {
if (static_cast<QWidget *>(object)->d_func()->data.in_destructor)
- return 0;
+ return nullptr;
} else if (QGesture *g = qobject_cast<QGesture *>(object)) {
return g;
#if QT_CONFIG(graphicsview)
@@ -196,7 +196,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
if (graphicsObject->QGraphicsItem::d_func()->inDestructor)
- return 0;
+ return nullptr;
#endif
}
@@ -210,7 +210,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
Q_ASSERT(recognizer);
QGesture *state = recognizer->create(object);
if (!state)
- return 0;
+ return nullptr;
state->setParent(this);
if (state->gestureType() == Qt::CustomGesture) {
// if the recognizer didn't fill in the gesture type, then this
@@ -454,13 +454,13 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original)
// sort them per target widget by cherry picking from almostCanceledGestures and delivering
QSet<QGesture *> almostCanceledGestures = cancelledGestures;
while (!almostCanceledGestures.isEmpty()) {
- QWidget *target = 0;
+ QWidget *target = nullptr;
QSet<QGesture*> gestures;
iter = almostCanceledGestures.begin();
// sort per target widget
while (iter != almostCanceledGestures.end()) {
QWidget *widget = m_gestureTargets.value(*iter);
- if (target == 0)
+ if (target == nullptr)
target = widget;
if (target == widget) {
gestures << *iter;
@@ -508,7 +508,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
}
}
// find all gesture contexts for the widget tree
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
while (w)
{
for (ContextIterator it = w->d_func()->gestureContext.constBegin(),
@@ -587,7 +587,7 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
// sort gestures by types
foreach (QGesture *gesture, gestures) {
- QWidget *receiver = m_gestureTargets.value(gesture, 0);
+ QWidget *receiver = m_gestureTargets.value(gesture, nullptr);
Q_ASSERT(receiver);
if (receiver)
gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
@@ -611,7 +611,7 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
}
}
if (w->isWindow()) {
- w = 0;
+ w = nullptr;
break;
}
w = w->parentWidget();
@@ -637,7 +637,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
for (QSet<QGesture *>::const_iterator it = gestures.begin(),
e = gestures.end(); it != e; ++it) {
QGesture *gesture = *it;
- QWidget *target = m_gestureTargets.value(gesture, 0);
+ QWidget *target = m_gestureTargets.value(gesture, nullptr);
if (!target) {
// the gesture has just started and doesn't have a target yet.
Q_ASSERT(gesture->state() == Qt::GestureStarted);
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index 4f2b505e32..b4ac263c2b 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -84,7 +84,7 @@ public:
Qt::Alignment alignment() const { return item_->alignment(); }
QLayoutItem *item() { return item_; }
void setItem(QLayoutItem *newitem) { item_ = newitem; }
- QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = 0; return i; }
+ QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = nullptr; return i; }
int hStretch() { return item_->widget() ?
item_->widget()->sizePolicy().horizontalStretch() : 0; }
@@ -152,7 +152,7 @@ public:
if (index < things.count())
return things.at(index)->item();
else
- return 0;
+ return nullptr;
}
inline QLayoutItem *takeAt(int index) {
Q_Q(QGridLayout);
@@ -162,19 +162,19 @@ public:
if (QLayout *l = item->layout()) {
// sanity check in case the user passed something weird to QObject::setParent()
if (l->parent() == q)
- l->setParent(0);
+ l->setParent(nullptr);
}
delete b;
return item;
}
}
- return 0;
+ return nullptr;
}
QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override
{
if (!newitem)
- return 0;
- QLayoutItem *item = 0;
+ return nullptr;
+ QLayoutItem *item = nullptr;
QGridBox *b = things.value(index);
if (b) {
item = b->takeItem();
@@ -342,7 +342,7 @@ QGridLayoutPrivate::QGridLayoutPrivate()
setDirty();
rr = cc = 0;
nextR = nextC = 0;
- hfwData = 0;
+ hfwData = nullptr;
hReversed = false;
vReversed = false;
horizontalSpacing = -1;
@@ -429,7 +429,7 @@ int QGridLayoutPrivate::minimumHeightForWidth(int w, int hSpacing, int vSpacing)
if (!has_hfw)
return -1;
int top, bottom;
- effectiveMargins(0, &top, 0, &bottom);
+ effectiveMargins(nullptr, &top, nullptr, &bottom);
return hfw_minheight + top + bottom;
}
@@ -521,7 +521,7 @@ void QGridLayoutPrivate::setSize(int r, int c)
if (hfwData && (int)hfwData->size() < r) {
delete hfwData;
- hfwData = 0;
+ hfwData = nullptr;
hfw_width = -1;
}
rr = r;
@@ -710,14 +710,14 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain,
qSwap(numRows, numColumns);
}
- QStyle *style = 0;
+ QStyle *style = nullptr;
if (fixedSpacing < 0) {
if (QWidget *parentWidget = q->parentWidget())
style = parentWidget->style();
}
for (int c = 0; c < numColumns; ++c) {
- QGridBox *previousBox = 0;
+ QGridBox *previousBox = nullptr;
int previousRow = -1; // previous *non-empty* row
for (int r = 0; r < numRows; ++r) {
@@ -741,7 +741,7 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain,
if (style)
spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2,
- orientation, 0, q->parentWidget());
+ orientation, nullptr, q->parentWidget());
} else {
if (orientation == Qt::Vertical) {
QGridBox *sibling = vReversed ? previousBox : box;
@@ -1075,7 +1075,7 @@ QRect QGridLayoutPrivate::cellRect(int row, int col) const
new items are inserted.
*/
QGridLayout::QGridLayout(QWidget *parent)
- : QLayout(*new QGridLayoutPrivate, 0, parent)
+ : QLayout(*new QGridLayoutPrivate, nullptr, parent)
{
Q_D(QGridLayout);
d->expand(1, 1);
@@ -1089,7 +1089,7 @@ QGridLayout::QGridLayout(QWidget *parent)
will not be performed before this is inserted into another layout.
*/
QGridLayout::QGridLayout()
- : QLayout(*new QGridLayoutPrivate, 0, 0)
+ : QLayout(*new QGridLayoutPrivate, nullptr, nullptr)
{
Q_D(QGridLayout);
d->expand(1, 1);
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 3ce81a390b..d4ff9083f1 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -130,7 +130,7 @@ QLayout::QLayout(QWidget *parent)
management will work.
*/
QLayout::QLayout()
- : QObject(*new QLayoutPrivate, 0)
+ : QObject(*new QLayoutPrivate, nullptr)
{
}
@@ -149,14 +149,14 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
" already has a layout",
qUtf16Printable(QObject::objectName()), w->metaObject()->className(),
qUtf16Printable(w->objectName()));
- setParent(0);
+ setParent(nullptr);
} else {
d->topLevel = true;
w->d_func()->layout = this;
QT_TRY {
invalidate();
} QT_CATCH(...) {
- w->d_func()->layout = 0;
+ w->d_func()->layout = nullptr;
QT_RETHROW;
}
}
@@ -166,7 +166,7 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
QLayoutPrivate::QLayoutPrivate()
: QObjectPrivate(), insideSpacing(-1), userLeftMargin(-1), userTopMargin(-1), userRightMargin(-1),
userBottomMargin(-1), topLevel(false), enabled(true), activated(true), autoNewChild(false),
- constraint(QLayout::SetDefaultConstraint), menubar(0)
+ constraint(QLayout::SetDefaultConstraint), menubar(nullptr)
{
}
@@ -181,7 +181,7 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric
} else if (!topLevel) {
*result = 0;
} else if (QWidget *pw = q->parentWidget()) {
- *result = pw->style()->pixelMetric(pm, 0, pw);
+ *result = pw->style()->pixelMetric(pm, nullptr, pw);
} else {
*result = 0;
}
@@ -189,8 +189,8 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric
// Static item factory functions that allow for hooking things in Designer
-QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0;
-QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0;
+QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = nullptr;
+QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = nullptr;
QWidgetItem *QLayoutPrivate::createWidgetItem(const QLayout *layout, QWidget *widget)
{
@@ -583,18 +583,18 @@ static bool removeWidgetRecursively(QLayoutItem *li, QObject *w)
}
-void QLayoutPrivate::doResize(const QSize &r)
+void QLayoutPrivate::doResize()
{
Q_Q(QLayout);
- int mbh = menuBarHeightForWidth(menubar, r.width());
QWidget *mw = q->parentWidget();
QRect rect = mw->testAttribute(Qt::WA_LayoutOnEntireRect) ? mw->rect() : mw->contentsRect();
+ const int mbh = menuBarHeightForWidth(menubar, rect.width());
const int mbTop = rect.top();
rect.setTop(mbTop + mbh);
q->setGeometry(rect);
#if QT_CONFIG(menubar)
if (menubar)
- menubar->setGeometry(rect.left(), mbTop, r.width(), mbh);
+ menubar->setGeometry(rect.left(), mbTop, rect.width(), mbh);
#endif
}
@@ -613,12 +613,10 @@ void QLayout::widgetEvent(QEvent *e)
switch (e->type()) {
case QEvent::Resize:
- if (d->activated) {
- QResizeEvent *r = (QResizeEvent *)e;
- d->doResize(r->size());
- } else {
+ if (d->activated)
+ d->doResize();
+ else
activate();
- }
break;
case QEvent::ChildRemoved:
{
@@ -626,7 +624,7 @@ void QLayout::widgetEvent(QEvent *e)
if (c->child()->isWidgetType()) {
#if QT_CONFIG(menubar)
if (c->child() == d->menubar)
- d->menubar = 0;
+ d->menubar = nullptr;
#endif
removeWidgetRecursively(this, c->child());
}
@@ -766,7 +764,7 @@ QLayout::~QLayout()
{
Q_D(QLayout);
if (d->topLevel && parent() && parent()->isWidgetType() && parentWidget()->layout() == this)
- parentWidget()->d_func()->layout = 0;
+ parentWidget()->d_func()->layout = nullptr;
else if (QLayout *parentLayout = qobject_cast<QLayout *>(parent()))
parentLayout->removeItem(this);
}
@@ -921,7 +919,7 @@ void QLayout::addChildWidget(QWidget *w)
qWarning("QLayout::addChildWidget: %s \"%ls\" in wrong parent; moved to correct parent",
w->metaObject()->className(), qUtf16Printable(w->objectName()));
#endif
- pw = 0;
+ pw = nullptr;
}
bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide));
if (!pw && mw)
@@ -1116,7 +1114,7 @@ bool QLayout::activate()
break;
}
- d->doResize(mw->size());
+ d->doResize();
if (md->extra) {
md->extra->explicitMinSize = explMin;
@@ -1155,12 +1153,12 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
{
Q_D(QLayout);
if (!from || !to)
- return 0;
+ return nullptr;
if (from == to) // Do not return a QLayoutItem for \a from, since ownership still
return nullptr; // belongs to the layout (since nothing was changed)
int index = -1;
- QLayoutItem *item = 0;
+ QLayoutItem *item = nullptr;
for (int u = 0; u < count(); ++u) {
item = itemAt(u);
if (!item)
@@ -1178,7 +1176,7 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
}
}
if (index == -1)
- return 0;
+ return nullptr;
addChildWidget(to);
QLayoutItem *newitem = new QWidgetItem(to);
@@ -1339,7 +1337,7 @@ QRect QLayout::alignmentRect(const QRect &r) const
returned by QLayoutItems that have an alignment.
*/
QLayout *that = const_cast<QLayout *>(this);
- that->setAlignment(0);
+ that->setAlignment({ });
QSize ms = that->maximumSize();
that->setAlignment(a);
diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h
index 8e1d773355..2b19af48be 100644
--- a/src/widgets/kernel/qlayout_p.h
+++ b/src/widgets/kernel/qlayout_p.h
@@ -73,7 +73,7 @@ public:
QLayoutPrivate();
void getMargin(int *result, int userMargin, QStyle::PixelMetric pm) const;
- void doResize(const QSize &);
+ void doResize();
void reparentChildWidgets(QWidget *mw);
bool checkWidget(QWidget *widget) const;
bool checkLayout(QLayout *otherLayout) const;
diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp
index 19a47075a6..83bbd69b55 100644
--- a/src/widgets/kernel/qlayoutengine.cpp
+++ b/src/widgets/kernel/qlayoutengine.cpp
@@ -376,7 +376,11 @@ Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSize
Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i)
{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *w = const_cast<QWidgetItem *>(i)->widget();
+#else
+ QWidget *w = i->widget();
+#endif
return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(),
w->minimumSize(), w->maximumSize(),
w->sizePolicy());
@@ -414,8 +418,11 @@ Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint,
Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align)
{
- QWidget *w = const_cast<QWidgetItem*>(i)->widget();
-
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QWidget *w = const_cast<QWidgetItem *>(i)->widget();
+#else
+ QWidget *w = i->widget();
+#endif
return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(),
w->sizePolicy(), align);
}
@@ -433,7 +440,7 @@ Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm
return -1;
} else if (parent->isWidgetType()) {
QWidget *pw = static_cast<QWidget *>(parent);
- return pw->style()->pixelMetric(pm, 0, pw);
+ return pw->style()->pixelMetric(pm, nullptr, pw);
} else {
return static_cast<QLayout *>(parent)->spacing();
}
diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h
index 948c2424e6..2999bae646 100644
--- a/src/widgets/kernel/qlayoutengine_p.h
+++ b/src/widgets/kernel/qlayoutengine_p.h
@@ -105,9 +105,9 @@ Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i);
Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidget *w);
Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint,
const QSize &minSize, const QSize &maxSize,
- const QSizePolicy &sizePolicy, Qt::Alignment align = nullptr);
-Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align = nullptr);
-Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align = nullptr);
+ const QSizePolicy &sizePolicy, Qt::Alignment align = { });
+Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align = { });
+Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align = { });
Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm);
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 0aab0bb06d..af5750771d 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -291,14 +291,12 @@ void QSpacerItem::changeSize(int w, int h, QSizePolicy::Policy hPolicy,
/*!
Destructor.
*/
-QWidgetItem::~QWidgetItem() {}
+QWidgetItem::~QWidgetItem() = default;
/*!
Destroys the QLayoutItem.
*/
-QLayoutItem::~QLayoutItem()
-{
-}
+QLayoutItem::~QLayoutItem() = default;
/*!
Invalidates any cached information in this layout item.
@@ -362,7 +360,11 @@ QSpacerItem * QSpacerItem::spacerItem()
\sa layout(), spacerItem()
*/
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *QLayoutItem::widget()
+#else
+QWidget *QLayoutItem::widget() const
+#endif
{
return nullptr;
}
@@ -370,7 +372,11 @@ QWidget *QLayoutItem::widget()
/*!
Returns the widget managed by this item.
*/
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *QWidgetItem::widget()
+#else
+QWidget *QWidgetItem::widget() const
+#endif
{
return wid;
}
@@ -591,7 +597,7 @@ Qt::Orientations QSpacerItem::expandingDirections() const
Qt::Orientations QWidgetItem::expandingDirections() const
{
if (isEmpty())
- return Qt::Orientations(0);
+ return {};
Qt::Orientations e = wid->sizePolicy().expandingDirections();
/*
@@ -772,7 +778,7 @@ QWidgetItemV2::QWidgetItemV2(QWidget *widget)
q_cachedMaximumSize(Dirty, Dirty),
q_firstCachedHfw(0),
q_hfwCacheSize(0),
- d(0)
+ d(nullptr)
{
QWidgetPrivate *wd = wid->d_func();
if (!wd->widgetItem)
@@ -784,7 +790,7 @@ QWidgetItemV2::~QWidgetItemV2()
if (wid) {
auto *wd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(wid));
if (wd->widgetItem == this)
- wd->widgetItem = 0;
+ wd->widgetItem = nullptr;
}
}
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index 059ff2d470..8553e20adc 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -74,7 +74,11 @@ public:
virtual int minimumHeightForWidth(int) const;
virtual void invalidate();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
virtual QWidget *widget();
+#else
+ virtual QWidget *widget() const;
+#endif
virtual QLayout *layout();
virtual QSpacerItem *spacerItem();
@@ -133,7 +137,11 @@ public:
bool isEmpty() const override;
void setGeometry(const QRect&) override;
QRect geometry() const override;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWidget *widget() override;
+#else
+ QWidget *widget() const override;
+#endif
bool hasHeightForWidth() const override;
int heightForWidth(int) const override;
diff --git a/src/widgets/kernel/qmacgesturerecognizer.cpp b/src/widgets/kernel/qmacgesturerecognizer.cpp
index d39b93e320..aac115a2cf 100644
--- a/src/widgets/kernel/qmacgesturerecognizer.cpp
+++ b/src/widgets/kernel/qmacgesturerecognizer.cpp
@@ -149,8 +149,8 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
void QMacPinchGestureRecognizer::reset(QGesture *gesture)
{
QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
- g->setChangeFlags(0);
- g->setTotalChangeFlags(0);
+ g->setChangeFlags({});
+ g->setTotalChangeFlags({});
g->setScaleFactor(1.0f);
g->setTotalScaleFactor(1.0f);
g->setLastScaleFactor(1.0f);
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index bc5ca21b97..90622fd21e 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -555,16 +555,16 @@ class QOpenGLWidgetPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QOpenGLWidget)
public:
QOpenGLWidgetPrivate()
- : context(0),
- fbo(0),
- resolvedFbo(0),
- surface(0),
+ : context(nullptr),
+ fbo(nullptr),
+ resolvedFbo(nullptr),
+ surface(nullptr),
initialized(false),
fakeHidden(false),
inBackingStorePaint(false),
hasBeenComposed(false),
flushPending(false),
- paintDevice(0),
+ paintDevice(nullptr),
updateBehavior(QOpenGLWidget::NoPartialUpdate),
requestedSamples(0),
inPaintGL(false),
@@ -704,11 +704,11 @@ void QOpenGLWidgetPrivate::reset()
q->makeCurrent();
delete paintDevice;
- paintDevice = 0;
+ paintDevice = nullptr;
delete fbo;
- fbo = 0;
+ fbo = nullptr;
delete resolvedFbo;
- resolvedFbo = 0;
+ resolvedFbo = nullptr;
if (initialized)
q->doneCurrent();
@@ -717,9 +717,9 @@ void QOpenGLWidgetPrivate::reset()
// the context's aboutToBeDestroyed() may still call makeCurrent()
// to perform some cleanup.
delete context;
- context = 0;
+ context = nullptr;
delete surface;
- surface = 0;
+ surface = nullptr;
initialized = fakeHidden = inBackingStorePaint = false;
}
@@ -732,9 +732,9 @@ void QOpenGLWidgetPrivate::recreateFbo()
context->makeCurrent(surface);
delete fbo;
- fbo = 0;
+ fbo = nullptr;
delete resolvedFbo;
- resolvedFbo = 0;
+ resolvedFbo = nullptr;
int samples = requestedSamples;
QOpenGLExtensions *extfuncs = static_cast<QOpenGLExtensions *>(context->functions());
@@ -1421,7 +1421,7 @@ QPaintEngine *QOpenGLWidget::paintEngine() const
return QWidget::paintEngine();
if (!d->initialized)
- return 0;
+ return nullptr;
return d->paintDevice->paintEngine();
}
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index eec65c8625..d469279ea5 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -419,6 +419,76 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
\sa activated()
*/
+/*!
+ \fn template<typename Functor>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor.
+*/
+/*!
+ \fn template<typename Functor>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const QObject *context, Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor.
+
+ The \a functor can be a pointer to a member function of the \a context object.
+
+ If the \a context object is destroyed, the \a functor will not be called.
+*/
+/*!
+ \fn template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const QObject *context1, Functor functor,
+ FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor and
+ \l{QShortcut::activatedAmbiguously()}{activatedAmbiguously()}
+ signal to the \a FunctorAmbiguous.
+
+ The \a functor and \a FunctorAmbiguous can be a pointer to a member
+ function of the \a context object.
+
+ If the \a context object is destroyed, the \a functor and
+ \a FunctorAmbiguous will not be called.
+*/
+/*!
+ \fn template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const QObject *context1, Functor functor,
+ const QObject *context2, FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor and
+ \l{QShortcut::activatedAmbiguously()}{activatedAmbiguously()}
+ signal to the \a FunctorAmbiguous.
+
+ The \a functor can be a pointer to a member function of the
+ \a context1 object.
+ The \a FunctorAmbiguous can be a pointer to a member function of the
+ \a context2 object.
+
+ If the \a context1 object is destroyed, the \a functor will not be called.
+ If the \a context2 object is destroyed, the \a FunctorAmbiguous
+ will not be called.
+*/
+
/*
\internal
Private data accessed through d-pointer.
@@ -479,13 +549,13 @@ QShortcut::QShortcut(QWidget *parent)
*/
QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
const char *member, const char *ambiguousMember,
- Qt::ShortcutContext context)
+ Qt::ShortcutContext shortcutContext)
: QShortcut(parent)
{
QAPP_CHECK("QShortcut");
Q_D(QShortcut);
- d->sc_context = context;
+ d->sc_context = shortcutContext;
d->sc_sequence = key;
d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
if (member)
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 6dcf4971b2..4f9c5ba0f7 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -61,9 +61,65 @@ class Q_WIDGETS_EXPORT QShortcut : public QObject
Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
public:
explicit QShortcut(QWidget *parent);
- QShortcut(const QKeySequence& key, QWidget *parent,
+ QShortcut(const QKeySequence &key, QWidget *parent,
const char *member = nullptr, const char *ambiguousMember = nullptr,
- Qt::ShortcutContext context = Qt::WindowShortcut);
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+#ifdef Q_CLANG_QDOC
+ template<typename Functor>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const QObject *context, Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const QObject *context1, Functor functor,
+ FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const QObject *context1, Functor functor,
+ const QObject *context2, FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+#else
+ template<typename Func1>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ Func1 slot1,
+ Qt::ShortcutContext context = Qt::WindowShortcut)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, std::move(slot1));
+ }
+ template<class Obj1, typename Func1>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const Obj1 *object1, Func1 slot1,
+ Qt::ShortcutContext context = Qt::WindowShortcut)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ }
+ template<class Obj1, typename Func1, typename Func2>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const Obj1 *object1, Func1 slot1, Func2 slot2,
+ Qt::ShortcutContext context = Qt::WindowShortcut)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ connect(this, &QShortcut::activatedAmbiguously, object1, std::move(slot2));
+ }
+ template<class Obj1, typename Func1, class Obj2, typename Func2>
+ QShortcut(const QKeySequence &key, QWidget *parent,
+ const Obj1 *object1, Func1 slot1,
+ const Obj2 *object2, Func2 slot2,
+ Qt::ShortcutContext context = Qt::WindowShortcut)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ connect(this, &QShortcut::activatedAmbiguously, object2, std::move(slot2));
+ }
+#endif
~QShortcut();
void setKey(const QKeySequence& key);
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 0412dc188d..f87fe96cc0 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -61,11 +61,11 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem)
{
Q_Q(QStackedLayout);
if (idx < 0 || idx >= list.size() || !newitem)
- return 0;
+ return nullptr;
QWidget *wdg = newitem->widget();
if (Q_UNLIKELY(!wdg)) {
qWarning("QStackedLayout::replaceAt: Only widgets can be added");
- return 0;
+ return nullptr;
}
QLayoutItem *orgitem = list.at(idx);
list.replace(idx, newitem);
@@ -154,7 +154,7 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem)
\sa addWidget(), insertWidget()
*/
QStackedLayout::QStackedLayout()
- : QLayout(*new QStackedLayoutPrivate, 0, 0)
+ : QLayout(*new QStackedLayoutPrivate, nullptr, nullptr)
{
}
@@ -165,7 +165,7 @@ QStackedLayout::QStackedLayout()
manage the geometry of its children.
*/
QStackedLayout::QStackedLayout(QWidget *parent)
- : QLayout(*new QStackedLayoutPrivate, 0, parent)
+ : QLayout(*new QStackedLayoutPrivate, nullptr, parent)
{
}
@@ -174,7 +174,7 @@ QStackedLayout::QStackedLayout(QWidget *parent)
the given \a parentLayout.
*/
QStackedLayout::QStackedLayout(QLayout *parentLayout)
- : QLayout(*new QStackedLayoutPrivate, parentLayout, 0)
+ : QLayout(*new QStackedLayoutPrivate, parentLayout, nullptr)
{
}
@@ -264,7 +264,7 @@ QLayoutItem *QStackedLayout::takeAt(int index)
{
Q_D(QStackedLayout);
if (index <0 || index >= d->list.size())
- return 0;
+ return nullptr;
QLayoutItem *item = d->list.takeAt(index);
if (index == d->index) {
d->index = -1;
@@ -307,7 +307,7 @@ void QStackedLayout::setCurrentIndex(int index)
parent->setUpdatesEnabled(false);
}
- QPointer<QWidget> fw = parent ? parent->window()->focusWidget() : 0;
+ QPointer<QWidget> fw = parent ? parent->window()->focusWidget() : nullptr;
const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw));
if (prev) {
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index 8a95b12d89..a5c204d59d 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -183,7 +183,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
}
case QEvent::TouchUpdate: {
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
- d->changeFlags = 0;
+ d->changeFlags = { };
if (ev->touchPoints().size() == 2) {
QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
@@ -256,7 +256,7 @@ void QPinchGestureRecognizer::reset(QGesture *state)
QPinchGesture *pinch = static_cast<QPinchGesture *>(state);
QPinchGesturePrivate *d = pinch->d_func();
- d->totalChangeFlags = d->changeFlags = 0;
+ d->totalChangeFlags = d->changeFlags = { };
d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF();
d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 1;
diff --git a/src/widgets/kernel/qtestsupport_widgets.h b/src/widgets/kernel/qtestsupport_widgets.h
index ca1406b0b2..2b37a9e858 100644
--- a/src/widgets/kernel/qtestsupport_widgets.h
+++ b/src/widgets/kernel/qtestsupport_widgets.h
@@ -40,7 +40,7 @@
#ifndef QTESTSUPPORT_WIDGETS_H
#define QTESTSUPPORT_WIDGETS_H
-#include "qtwidgetsglobal.h"
+#include <QtWidgets/qtwidgetsglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 1ec3612457..33dd3e59b6 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -154,7 +154,7 @@ public slots:
*/
void styleSheetParentDestroyed() {
setProperty("_q_stylesheet_parent", QVariant());
- styleSheetParent = 0;
+ styleSheetParent = nullptr;
}
private:
@@ -166,11 +166,11 @@ private:
QRect rect;
};
-QTipLabel *QTipLabel::instance = 0;
+QTipLabel *QTipLabel::instance = nullptr;
QTipLabel::QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int msecDisplayTime)
#ifndef QT_NO_STYLE_STYLESHEET
- : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0)
+ : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(nullptr), widget(nullptr)
#else
: QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0)
#endif
@@ -181,12 +181,12 @@ QTipLabel::QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int mse
setBackgroundRole(QPalette::ToolTipBase);
setPalette(QToolTip::palette());
ensurePolished();
- setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
+ setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, this));
setFrameStyle(QFrame::NoFrame);
setAlignment(Qt::AlignLeft);
setIndent(1);
qApp->installEventFilter(this);
- setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
+ setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0);
setMouseTracking(true);
fadingOut = false;
reuseTip(text, msecDisplayTime, pos);
@@ -207,7 +207,7 @@ void QTipLabel::reuseTip(const QString &text, int msecDisplayTime, const QPoint
if (styleSheetParent){
disconnect(styleSheetParent, SIGNAL(destroyed()),
QTipLabel::instance, SLOT(styleSheetParentDestroyed()));
- styleSheetParent = 0;
+ styleSheetParent = nullptr;
}
#endif
@@ -281,7 +281,7 @@ void QTipLabel::mouseMoveEvent(QMouseEvent *e)
QTipLabel::~QTipLabel()
{
- instance = 0;
+ instance = nullptr;
}
void QTipLabel::hideTip()
@@ -560,7 +560,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w)
*/
bool QToolTip::isVisible()
{
- return (QTipLabel::instance != 0 && QTipLabel::instance->isVisible());
+ return (QTipLabel::instance != nullptr && QTipLabel::instance->isVisible());
}
/*!
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 228ca4d38a..8a632a395a 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -163,7 +163,7 @@ private:
QPixmap background;
};
-QWhatsThat *QWhatsThat::instance = 0;
+QWhatsThat *QWhatsThat::instance = nullptr;
// shadowWidth not const, for XP drop-shadow-fu turns it to 0
static int shadowWidth = 6; // also used as '5' and '6' and even '8' below
@@ -193,7 +193,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
setCursor(Qt::ArrowCursor);
#endif
QRect r;
- doc = 0;
+ doc = nullptr;
ensurePolished(); // Ensures style sheet font before size calc
if (Qt::mightBeRichText(text)) {
doc = new QTextDocument();
@@ -229,7 +229,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
QWhatsThat::~QWhatsThat()
{
- instance = 0;
+ instance = nullptr;
if (doc)
delete doc;
}
@@ -383,7 +383,7 @@ void QWhatsThisPrivate::notifyToplevels(QEvent *e)
QCoreApplication::sendEvent(w, e);
}
-QWhatsThisPrivate *QWhatsThisPrivate::instance = 0;
+QWhatsThisPrivate *QWhatsThisPrivate::instance = nullptr;
QWhatsThisPrivate::QWhatsThisPrivate()
: leaveOnMouseRelease(false)
@@ -423,7 +423,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate()
QAccessibleEvent event(this, QAccessible::ContextHelpEnd);
QAccessible::updateAccessibility(&event);
#endif
- instance = 0;
+ instance = nullptr;
}
bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
@@ -497,7 +497,7 @@ class QWhatsThisAction: public QAction
Q_OBJECT
public:
- explicit QWhatsThisAction(QObject* parent = 0);
+ explicit QWhatsThisAction(QObject* parent = nullptr);
private slots:
void actionTriggered();
@@ -553,7 +553,7 @@ void QWhatsThis::enterWhatsThisMode()
*/
bool QWhatsThis::inWhatsThisMode()
{
- return (QWhatsThisPrivate::instance != 0);
+ return (QWhatsThisPrivate::instance != nullptr);
}
/*!
@@ -577,7 +577,7 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y)
if (text.size() == 0)
return;
// make a fresh widget, and set it up
- QWhatsThat *whatsThat = new QWhatsThat(text, 0, widget);
+ QWhatsThat *whatsThat = new QWhatsThat(text, nullptr, widget);
// okay, now to find a suitable location
int scr = (widget ?
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index dcc694efe4..767a1d2a8a 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -132,16 +132,16 @@ extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
QWidgetPrivate::QWidgetPrivate(int version)
: QObjectPrivate(version)
- , focus_next(0)
- , focus_prev(0)
- , focus_child(0)
- , layout(0)
- , needsFlush(0)
- , redirectDev(0)
- , widgetItem(0)
- , extraPaintEngine(0)
- , polished(0)
- , graphicsEffect(0)
+ , focus_next(nullptr)
+ , focus_prev(nullptr)
+ , focus_child(nullptr)
+ , layout(nullptr)
+ , needsFlush(nullptr)
+ , redirectDev(nullptr)
+ , widgetItem(nullptr)
+ , extraPaintEngine(nullptr)
+ , polished(nullptr)
+ , graphicsEffect(nullptr)
#if !defined(QT_NO_IM)
, imHints(Qt::ImhNone)
#endif
@@ -159,7 +159,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, topLayoutItemMargin(0)
, rightLayoutItemMargin(0)
, bottomLayoutItemMargin(0)
- , hd(0)
+ , hd(nullptr)
, size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred)
, fg_role(QPalette::NoRole)
, bg_role(QPalette::NoRole)
@@ -214,7 +214,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
QWidgetPrivate::~QWidgetPrivate()
{
if (widgetItem)
- widgetItem->wid = 0;
+ widgetItem->wid = nullptr;
if (extra)
deleteExtra();
@@ -396,7 +396,7 @@ void QWidget::setAutoFillBackground(bool enabled)
If it is \nullptr (the default), the new widget will be a window.
If not, it will be a child of \e parent, and be constrained by
\e parent's geometry (unless you specify Qt::Window as window flag).
- \li \c{Qt::WindowFlags f = 0} (where available) sets the window flags;
+ \li \c{Qt::WindowFlags f = { }} (where available) sets the window flags;
the default is suitable for almost all widgets, but to get, for
example, a window without a window system frame, you must use
special flags.
@@ -819,8 +819,8 @@ void QWidget::setAutoFillBackground(bool enabled)
*/
-QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
-QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid
+QWidgetMapper *QWidgetPrivate::mapper = nullptr; // widget with wid
+QWidgetSet *QWidgetPrivate::allWidgets = nullptr; // widgets with no wid
/*****************************************************************************
@@ -890,7 +890,7 @@ struct QWidgetExceptionCleaner
\sa windowFlags
*/
QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
- : QObject(*new QWidgetPrivate, 0), QPaintDevice()
+ : QObject(*new QWidgetPrivate, nullptr), QPaintDevice()
{
QT_TRY {
d_func()->init(parent, f);
@@ -904,7 +904,7 @@ QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
/*! \internal
*/
QWidget::QWidget(QWidgetPrivate &dd, QWidget* parent, Qt::WindowFlags f)
- : QObject(dd, 0), QPaintDevice()
+ : QObject(dd, nullptr), QPaintDevice()
{
Q_D(QWidget);
QT_TRY {
@@ -996,7 +996,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (parentWidget && parentWidget->windowType() == Qt::Desktop) {
const QDesktopScreenWidget *sw = qobject_cast<const QDesktopScreenWidget *>(parentWidget);
targetScreen = sw ? sw->screenNumber() : 0;
- parentWidget = 0;
+ parentWidget = nullptr;
}
q->data = &data;
@@ -1072,7 +1072,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
QCoreApplication::sendEvent(q, &e);
QCoreApplication::postEvent(q, new QEvent(QEvent::PolishRequest));
- extraPaintEngine = 0;
+ extraPaintEngine = nullptr;
}
void QWidgetPrivate::createRecursively()
@@ -1307,9 +1307,9 @@ void QWidgetPrivate::create()
if (nativeParent->windowHandle()) {
if (flags & Qt::Window) {
win->setTransientParent(nativeParent->window()->windowHandle());
- win->setParent(0);
+ win->setParent(nullptr);
} else {
- win->setTransientParent(0);
+ win->setTransientParent(nullptr);
win->setParent(nativeParent->windowHandle());
}
}
@@ -1442,7 +1442,7 @@ QWidget::~QWidget()
// delete layout while we still are a valid widget
delete d->layout;
- d->layout = 0;
+ d->layout = nullptr;
// Remove myself from focus list
Q_ASSERT(d->focus_next->d_func()->focus_prev == this);
@@ -1451,7 +1451,7 @@ QWidget::~QWidget()
if (d->focus_next != this) {
d->focus_next->d_func()->focus_prev = d->focus_prev;
d->focus_prev->d_func()->focus_next = d->focus_next;
- d->focus_next = d->focus_prev = 0;
+ d->focus_next = d->focus_prev = nullptr;
}
@@ -1493,7 +1493,7 @@ QWidget::~QWidget()
}
delete d->needsFlush;
- d->needsFlush = 0;
+ d->needsFlush = nullptr;
// The next 20 lines are duplicated from QObject, but required here
// since QWidget deletes is children itself
@@ -1520,7 +1520,7 @@ QWidget::~QWidget()
if (QAbstractDeclarativeData::destroyed)
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
}
- d->declarativeData = 0; // don't activate again in ~QObject
+ d->declarativeData = nullptr; // don't activate again in ~QObject
d->wasDeleted = false;
}
@@ -1564,7 +1564,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier
// will have the same windowid (the root window id) as the
// qt_desktopWidget. We should not add the second desktop widget
// to the mapper.
- bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
+ bool userDesktopWidget = qt_desktopWidget != nullptr && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
if (mapper && data.winid && !userDesktopWidget) {
mapper->remove(data.winid);
}
@@ -1589,19 +1589,19 @@ void QWidgetPrivate::createTLExtra()
if (!extra->topextra) {
extra->topextra = qt_make_unique<QTLWExtra>();
QTLWExtra* x = extra->topextra.get();
- x->backingStore = 0;
- x->sharedPainter = 0;
+ x->backingStore = nullptr;
+ x->sharedPainter = nullptr;
x->incw = x->inch = 0;
x->basew = x->baseh = 0;
x->frameStrut.setCoords(0, 0, 0, 0);
x->normalGeometry = QRect(0,0,-1,-1);
- x->savedFlags = 0;
+ x->savedFlags = { };
x->opacity = 255;
x->posIncludesFrame = 0;
x->sizeAdjusted = false;
x->inTopLevelResize = false;
x->embedded = 0;
- x->window = 0;
+ x->window = nullptr;
x->initialScreenIndex = -1;
#ifdef QWIDGET_EXTRA_DEBUG
@@ -1620,9 +1620,9 @@ void QWidgetPrivate::createExtra()
{
if (!extra) { // if not exists
extra = qt_make_unique<QWExtra>();
- extra->glContext = 0;
+ extra->glContext = nullptr;
#if QT_CONFIG(graphicsview)
- extra->proxyWidget = 0;
+ extra->proxyWidget = nullptr;
#endif
extra->minw = 0;
extra->minh = 0;
@@ -1681,7 +1681,7 @@ static void deleteBackingStore(QWidgetPrivate *d)
QTLWExtra *topData = d->topData();
delete topData->backingStore;
- topData->backingStore = 0;
+ topData->backingStore = nullptr;
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -1705,7 +1705,7 @@ void QWidgetPrivate::deleteTLSysExtra()
extra->topextra->window->destroy();
}
delete extra->topextra->window;
- extra->topextra->window = 0;
+ extra->topextra->window = nullptr;
}
}
@@ -1805,7 +1805,7 @@ void QWidgetPrivate::paintOnScreen(const QRegion &rgn)
if (toBePainted.isEmpty())
return; // Nothing to repaint.
- drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0);
+ drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, nullptr);
if (Q_UNLIKELY(q->paintingActive()))
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
@@ -2302,10 +2302,10 @@ void QWidgetPrivate::deactivateWidgetCleanup()
Q_Q(QWidget);
// If this was the active application window, reset it
if (QApplication::activeWindow() == q)
- QApplication::setActiveWindow(0);
+ QApplication::setActiveWindow(nullptr);
// If the is the active mouse press widget, reset it
if (q == qt_button_down)
- qt_button_down = 0;
+ qt_button_down = nullptr;
}
@@ -2563,7 +2563,7 @@ void QWidget::setStyleSheet(const QString& styleSheet)
if (testAttribute(Qt::WA_SetStyle)) {
d->setStyle_helper(new QStyleSheetStyle(d->extra->style), true);
} else {
- d->setStyle_helper(new QStyleSheetStyle(0), true);
+ d->setStyle_helper(new QStyleSheetStyle(nullptr), true);
}
}
@@ -2606,7 +2606,7 @@ QStyle *QWidget::style() const
void QWidget::setStyle(QStyle *style)
{
Q_D(QWidget);
- setAttribute(Qt::WA_SetStyle, style != 0);
+ setAttribute(Qt::WA_SetStyle, style != nullptr);
d->createExtra();
#ifndef QT_NO_STYLE_STYLESHEET
if (QStyleSheetStyle *styleSheetStyle = qt_styleSheet(style)) {
@@ -2686,7 +2686,7 @@ void QWidgetPrivate::inheritStyle()
QStyle *origStyle = proxy ? proxy->base : extraStyle;
QWidget *parent = q->parentWidget();
- QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : 0;
+ QStyle *parentStyle = (parent && parent->d_func()->extra) ? (QStyle*)parent->d_func()->extra->style : nullptr;
// If we have stylesheet on app or parent has stylesheet style, we need
// to be running a proxy
if (!qApp->styleSheet().isEmpty() || qt_styleSheet(parentStyle)) {
@@ -2709,7 +2709,7 @@ void QWidgetPrivate::inheritStyle()
// In such a case we need to start following the application style (i.e revert
// the propagation behavior of QStyleSheetStyle)
if (!q->testAttribute(Qt::WA_SetStyle))
- origStyle = 0;
+ origStyle = nullptr;
setStyle_helper(origStyle, true);
#endif // QT_NO_STYLE_STYLESHEET
@@ -3085,7 +3085,7 @@ bool QWidget::isEnabledTo(const QWidget *ancestor) const
*/
void QWidget::addAction(QAction *action)
{
- insertAction(0, action);
+ insertAction(nullptr, action);
}
/*!
@@ -3100,7 +3100,7 @@ void QWidget::addActions(QList<QAction*> actions)
#endif
{
for(int i = 0; i < actions.count(); i++)
- insertAction(0, actions.at(i));
+ insertAction(nullptr, actions.at(i));
}
/*!
@@ -3125,7 +3125,7 @@ void QWidget::insertAction(QAction *before, QAction *action)
int pos = d->actions.indexOf(before);
if (pos < 0) {
- before = 0;
+ before = nullptr;
pos = d->actions.size();
}
d->actions.insert(pos, action);
@@ -4606,7 +4606,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
Q_Q(QWidget);
#ifndef QT_NO_STYLE_STYLESHEET
const QStyleSheetStyle* cssStyle;
- cssStyle = extra ? qt_styleSheet(extra->style) : 0;
+ cssStyle = extra ? qt_styleSheet(extra->style) : nullptr;
const bool useStyleSheetPropagationInWidgetStyles =
QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);
#endif
@@ -4842,7 +4842,7 @@ void qt_qpa_set_cursor(QWidget *w, bool force)
if (!w->testAttribute(Qt::WA_WState_Created))
return;
- static QPointer<QWidget> lastUnderMouse = 0;
+ static QPointer<QWidget> lastUnderMouse = nullptr;
if (force) {
lastUnderMouse = w;
} else if (lastUnderMouse) {
@@ -5119,7 +5119,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
if (d->graphicsEffect) {
d->invalidateBackingStore(rect());
delete d->graphicsEffect;
- d->graphicsEffect = 0;
+ d->graphicsEffect = nullptr;
}
if (effect) {
@@ -5313,7 +5313,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
setSystemClip(sharedPainter->paintEngine(), 1, QRegion());
sharedPainter->restore();
}
- sourced->context = 0;
+ sourced->context = nullptr;
if (repaintManager)
repaintManager->markNeedsFlush(q, rgn, offset);
@@ -5431,7 +5431,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (!sharedPainter)
paintEngine->d_func()->systemRect = QRect();
else
- paintEngine->d_func()->currentClipDevice = 0;
+ paintEngine->d_func()->currentClipDevice = nullptr;
setSystemClip(pdev->paintEngine(), 1, QRegion());
}
@@ -5492,7 +5492,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
if (paintRegion.isEmpty())
return;
- QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
+ QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : nullptr;
// Use the target's shared painter if set (typically set when doing
// "other->render(widget);" in the widget's paintEvent.
@@ -5553,7 +5553,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
const QPoint &offset, DrawWidgetFlags flags
, QPainter *sharedPainter, QWidgetRepaintManager *repaintManager)
{
- QWidget *w = 0;
+ QWidget *w = nullptr;
QRect boundingRect;
bool dirtyBoundingRect = true;
const bool exludeOpaqueChildren = (flags & DontDrawOpaqueChildren);
@@ -5847,7 +5847,7 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg
if (count%2) { // odd number of [*] -> replace last one
int lastIndex = cap.lastIndexOf(placeHolder, index - 1);
if (widget->isWindowModified()
- && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, widget))
+ && widget->style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, nullptr, widget))
cap.replace(lastIndex, 3, QWidget::tr("*"));
else
cap.remove(lastIndex, 3);
@@ -6299,7 +6299,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
return;
#if QT_CONFIG(graphicsview)
- QWidget *previousProxyFocus = 0;
+ QWidget *previousProxyFocus = nullptr;
if (const auto &topData = window()->d_func()->extra) {
if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
@@ -6439,12 +6439,12 @@ void QWidgetPrivate::updateFocusChild()
if (q->isHidden()) {
while (w && w->isHidden()) {
w->d_func()->focus_child = q;
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
}
} else {
while (w) {
w->d_func()->focus_child = q;
- w = w->isWindow() ? 0 : w->parentWidget();
+ w = w->isWindow() ? nullptr : w->parentWidget();
}
}
@@ -6490,7 +6490,7 @@ void QWidget::clearFocus()
while (w) {
// Just like setFocus(), we update (clear) the focus_child of our parents
if (w->d_func()->focus_child == this)
- w->d_func()->focus_child = 0;
+ w->d_func()->focus_child = nullptr;
w = w->parentWidget();
}
@@ -6511,7 +6511,7 @@ void QWidget::clearFocus()
if (hasFocus()) {
// Update proxy state
- QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
+ QApplicationPrivate::setFocusWidget(nullptr, Qt::OtherFocusReason);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(this, QAccessible::Focus);
QAccessible::updateAccessibility(&event);
@@ -6588,10 +6588,10 @@ bool QWidget::focusNextPrevChild(bool next)
*/
if (wrappingOccurred) {
QWindow *window = windowHandle();
- if (window != 0) {
+ if (window != nullptr) {
QWindowPrivate *winp = qt_window_private(window);
- if (winp->platformWindow != 0) {
+ if (winp->platformWindow != nullptr) {
QFocusEvent event(QEvent::FocusIn, reason);
event.ignore();
winp->platformWindow->windowEvent(&event);
@@ -6669,7 +6669,7 @@ bool QWidget::isActiveWindow() const
}
#endif
- if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {
+ if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, this)) {
if(tlw->windowType() == Qt::Tool &&
!tlw->isModal() &&
(!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow()))
@@ -6825,9 +6825,9 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw)
focus_child->clearFocus();
// separate the focus chain into new (children of myself) and old (the rest)
- QWidget *firstOld = 0;
+ QWidget *firstOld = nullptr;
//QWidget *firstNew = q; //invariant
- QWidget *o = 0; // last in the old list
+ QWidget *o = nullptr; // last in the old list
QWidget *n = q; // last in the new list
bool prevWasNew = true;
@@ -7835,7 +7835,7 @@ void QWidgetPrivate::show_helper()
#endif
if (QApplicationPrivate::hidden_focus_widget == q) {
- QApplicationPrivate::hidden_focus_widget = 0;
+ QApplicationPrivate::hidden_focus_widget = nullptr;
q->setFocus(Qt::OtherFocusReason);
}
@@ -7934,7 +7934,7 @@ void QWidgetPrivate::hide_helper()
bool isEmbedded = false;
#if QT_CONFIG(graphicsview)
- isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;
+ isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != nullptr;
#else
Q_UNUSED(isEmbedded);
#endif
@@ -8127,7 +8127,7 @@ void QWidgetPrivate::setVisible(bool visible)
QCoreApplication::sendEvent(q, &showToParentEvent);
} else { // hide
if (QApplicationPrivate::hidden_focus_widget == q)
- QApplicationPrivate::hidden_focus_widget = 0;
+ QApplicationPrivate::hidden_focus_widget = nullptr;
// hw: The test on getOpaqueRegion() needs to be more intelligent
// currently it doesn't work if the widget is hidden (the region will
@@ -8837,7 +8837,7 @@ bool QWidget::event(QEvent *event)
case Qt::ActionsContextMenu:
if (d->actions.count()) {
QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
- 0, this);
+ nullptr, this);
break;
}
Q_FALLTHROUGH();
@@ -10029,9 +10029,9 @@ QLayout *QWidget::takeLayout()
Q_D(QWidget);
QLayout *l = layout();
if (!l)
- return 0;
- d->layout = 0;
- l->setParent(0);
+ return nullptr;
+ d->layout = nullptr;
+ l->setParent(nullptr);
return l;
}
@@ -10153,10 +10153,10 @@ QWidget *QWidget::childAt(const QPoint &p) const
QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const
{
if (children.isEmpty())
- return 0;
+ return nullptr;
if (!pointInsideRectAndMask(p))
- return 0;
+ return nullptr;
return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
}
@@ -10184,7 +10184,7 @@ QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChil
// We have found our target; namely the child at position 'p'.
return child;
}
- return 0;
+ return nullptr;
}
void QWidgetPrivate::updateGeometry_helper(bool forceUpdate)
@@ -10397,7 +10397,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
if (f & Qt::Window) // Frame geometry likely changes, refresh.
d->data.fstrut_dirty = true;
- QWidget *desktopWidget = 0;
+ QWidget *desktopWidget = nullptr;
if (parent && parent->windowType() == Qt::Desktop)
desktopWidget = parent;
bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
@@ -10425,7 +10425,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
d->setParent_sys(parent, f);
if (desktopWidget)
- parent = 0;
+ parent = nullptr;
#ifndef QT_NO_OPENGL
if (d->textureChildSeen && parent) {
@@ -10539,7 +10539,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
// programmer specified desktop widget
const QDesktopScreenWidget *sw = qobject_cast<const QDesktopScreenWidget *>(newparent);
targetScreen = sw ? sw->screenNumber() : 0;
- newparent = 0;
+ newparent = nullptr;
}
setWinId(0);
@@ -10549,19 +10549,19 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
if (q->windowHandle()) {
q->windowHandle()->setFlags(f);
QWidget *parentWithWindow =
- newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;
+ newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : nullptr;
if (parentWithWindow) {
QWidget *topLevel = parentWithWindow->window();
if ((f & Qt::Window) && topLevel && topLevel->windowHandle()) {
q->windowHandle()->setTransientParent(topLevel->windowHandle());
- q->windowHandle()->setParent(0);
+ q->windowHandle()->setParent(nullptr);
} else {
- q->windowHandle()->setTransientParent(0);
+ q->windowHandle()->setTransientParent(nullptr);
q->windowHandle()->setParent(parentWithWindow->windowHandle());
}
} else {
- q->windowHandle()->setTransientParent(0);
- q->windowHandle()->setParent(0);
+ q->windowHandle()->setTransientParent(nullptr);
+ q->windowHandle()->setParent(nullptr);
}
}
}
@@ -10592,7 +10592,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
continue;
QWidgetWindow *childWW = qobject_cast<QWidgetWindow *>(childWindow);
- QWidget *childWidget = childWW ? childWW->widget() : 0;
+ QWidget *childWidget = childWW ? childWW->widget() : nullptr;
if (!childWW || (childWidget && childWidget->testAttribute(Qt::WA_NativeWindow)))
childWindow->setParent(newParentWindow);
}
@@ -11998,7 +11998,7 @@ QOpenGLContext *QWidgetPrivate::shareContext() const
return 0;
#else
if (!extra || !extra->topextra || !extra->topextra->window)
- return 0;
+ return nullptr;
if (!extra->topextra->shareContext) {
auto ctx = qt_make_unique<QOpenGLContext>();
@@ -12057,7 +12057,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
if (d->extra) {
return d->extra->proxyWidget;
}
- return 0;
+ return nullptr;
}
#endif
@@ -12118,7 +12118,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
qApp->d_func()->closePopup(this);
if (this == QApplicationPrivate::active_window)
- QApplication::setActiveWindow(0);
+ QApplication::setActiveWindow(nullptr);
if (QWidget::mouseGrabber() == this)
releaseMouse();
if (QWidget::keyboardGrabber() == this)
@@ -12182,7 +12182,7 @@ QPaintEngine *QWidget::paintEngine() const
const_cast<QWidgetPrivate *>(d_func())->noPaintOnScreen = 1;
#endif
- return 0; //##### @@@
+ return nullptr; //##### @@@
}
// Do not call QWindow::mapToGlobal() until QPlatformWindow is properly showing.
@@ -12269,10 +12269,10 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
return t.transform.inverted().map(windowLocal);
}
-QWidget *qt_pressGrab = 0;
-QWidget *qt_mouseGrb = 0;
+QWidget *qt_pressGrab = nullptr;
+QWidget *qt_mouseGrb = nullptr;
static bool mouseGrabWithCursor = false;
-static QWidget *keyboardGrb = 0;
+static QWidget *keyboardGrb = nullptr;
static inline QWindow *grabberWindow(const QWidget *w)
{
@@ -12284,7 +12284,7 @@ static inline QWindow *grabberWindow(const QWidget *w)
}
#ifndef QT_NO_CURSOR
-static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = 0)
+static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = nullptr)
#else
static void grabMouseForWidget(QWidget *widget)
#endif
@@ -12304,7 +12304,7 @@ static void grabMouseForWidget(QWidget *widget)
}
qt_mouseGrb = widget;
- qt_pressGrab = 0;
+ qt_pressGrab = nullptr;
}
static void releaseMouseGrabOfWidget(QWidget *widget)
@@ -12320,7 +12320,7 @@ static void releaseMouseGrabOfWidget(QWidget *widget)
window->setMouseGrabEnabled(false);
}
}
- qt_mouseGrb = 0;
+ qt_mouseGrb = nullptr;
}
/*!
@@ -12449,7 +12449,7 @@ void QWidget::releaseKeyboard()
if (keyboardGrb == this) {
if (QWindow *window = grabberWindow(this))
window->setKeyboardGrabEnabled(false);
- keyboardGrb = 0;
+ keyboardGrb = nullptr;
}
}
@@ -12526,8 +12526,8 @@ void QWidget::activateWindow()
*/
int QWidget::metric(PaintDeviceMetric m) const
{
- QWindow *topLevelWindow = 0;
- QScreen *screen = 0;
+ QWindow *topLevelWindow = nullptr;
+ QScreen *screen = nullptr;
if (QWidget *topLevel = window()) {
topLevelWindow = topLevel->windowHandle();
if (topLevelWindow)
@@ -12613,14 +12613,14 @@ QPainter *QWidget::sharedPainter() const
{
// Someone sent a paint event directly to the widget
if (!d_func()->redirectDev)
- return 0;
+ return nullptr;
QPainter *sp = d_func()->sharedPainter();
if (!sp || !sp->isActive())
- return 0;
+ return nullptr;
if (sp->paintEngine()->paintDevice() != d_func()->redirectDev)
- return 0;
+ return nullptr;
return sp;
}
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 83a6e6d4b3..415a738eb4 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -175,11 +175,11 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
Q_PROPERTY(QSize sizeHint READ sizeHint)
Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint)
Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops)
- Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle NOTIFY windowTitleChanged DESIGNABLE isWindow)
- Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged DESIGNABLE isWindow)
- Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged DESIGNABLE isWindow) // deprecated
- Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow)
- Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow)
+ Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle NOTIFY windowTitleChanged)
+ Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
+ Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged) // deprecated
+ Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity)
+ Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified)
#ifndef QT_NO_TOOLTIP
Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
Q_PROPERTY(int toolTipDuration READ toolTipDuration WRITE setToolTipDuration)
@@ -201,7 +201,7 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
#endif
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale)
- Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow)
+ Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath)
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
public:
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 698928b0b0..6915782cb3 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -420,7 +420,7 @@ public:
void setVisible(bool);
void setEnabled_helper(bool);
- static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0);
+ static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = nullptr);
void updateFrameStrut();
QRect frameStrut() const;
@@ -592,7 +592,7 @@ public:
Q_Q(QWidget);
return q->testAttribute(Qt::WA_AlwaysStackOnTop)
? QPlatformTextureList::StacksOnTop
- : QPlatformTextureList::Flags(nullptr);
+ : QPlatformTextureList::Flags();
}
virtual QImage grabFramebuffer() { return QImage(); }
virtual void beginBackingStorePainting() { }
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index 6eebaca42c..9649e51b92 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -146,7 +146,7 @@ void QWidgetAction::setDefaultWidget(QWidget *widget)
setVisible(!(widget->isHidden() && widget->testAttribute(Qt::WA_WState_ExplicitShowHide)));
d->defaultWidget->hide();
- d->defaultWidget->setParent(0);
+ d->defaultWidget->setParent(nullptr);
d->defaultWidgetInUse = false;
if (!isEnabled())
d->defaultWidget->setEnabled(false);
@@ -177,7 +177,7 @@ QWidget *QWidgetAction::requestWidget(QWidget *parent)
QWidget *w = createWidget(parent);
if (!w) {
if (d->defaultWidgetInUse || !d->defaultWidget)
- return 0;
+ return nullptr;
d->defaultWidget->setParent(parent);
d->defaultWidgetInUse = true;
return d->defaultWidget;
@@ -203,7 +203,7 @@ void QWidgetAction::releaseWidget(QWidget *widget)
if (widget == d->defaultWidget) {
d->defaultWidget->hide();
- d->defaultWidget->setParent(0);
+ d->defaultWidget->setParent(nullptr);
d->defaultWidgetInUse = false;
return;
}
@@ -251,7 +251,7 @@ bool QWidgetAction::eventFilter(QObject *obj, QEvent *event)
QWidget *QWidgetAction::createWidget(QWidget *parent)
{
Q_UNUSED(parent)
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp
index c3211e275f..135a1527ac 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager.cpp
+++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp
@@ -695,7 +695,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
return qt_dummy_platformTextureList();
}
- return 0;
+ return nullptr;
}
#else
@@ -788,7 +788,7 @@ bool QWidgetRepaintManager::syncAllowed()
QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
if (textureListWatcher && !textureListWatcher->isLocked()) {
textureListWatcher->deleteLater();
- textureListWatcher = 0;
+ textureListWatcher = nullptr;
} else if (!tlwExtra->widgetTextures.empty()) {
bool skipSync = false;
for (const auto &tl : tlwExtra->widgetTextures) {
@@ -822,7 +822,7 @@ void QWidgetRepaintManager::paintAndFlush()
if (hasStaticContents() && !store->size().isEmpty() ) {
// Repaint existing dirty area and newly visible area.
const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
- const QRegion staticRegion(staticContents(0, clipRect));
+ const QRegion staticRegion(staticContents(nullptr, clipRect));
QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
newVisible -= staticRegion;
dirty += newVisible;
@@ -1008,13 +1008,13 @@ void QWidgetRepaintManager::paintAndFlush()
QPoint offset;
if (w != tlw)
offset += w->mapTo(tlw, QPoint());
- wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this);
+ wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, nullptr, this);
}
// Paint the rest with composition.
if (repaintAllWidgets || !dirtyCopy.isEmpty()) {
QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
- tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, 0, this);
+ tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, nullptr, this);
}
store->endPaint();
@@ -1108,7 +1108,7 @@ void QWidgetRepaintManager::flush()
for (QWidget *w : qExchange(needsFlushWidgets, {})) {
QWidgetPrivate *wd = w->d_func();
Q_ASSERT(wd->needsFlush);
- QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : 0;
+ QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : nullptr;
flush(w, *wd->needsFlush, widgetTexturesForNative);
*wd->needsFlush = QRegion();
}
@@ -1284,7 +1284,7 @@ QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &with
wd->clipToEffectiveMask(visible);
if (visible.isEmpty())
continue;
- wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true);
+ wd->subtractOpaqueSiblings(visible, nullptr, /*alsoNonOpaque=*/true);
visible.translate(offset);
region += visible;
@@ -1331,7 +1331,7 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c
if (!staticContents || graphicsEffect) {
QRegion staticChildren;
- QWidgetRepaintManager *bs = 0;
+ QWidgetRepaintManager *bs = nullptr;
if (offset.isNull() && (bs = maybeRepaintManager()))
staticChildren = bs->staticContents(q, oldWidgetRect);
const bool hasStaticChildren = !staticChildren.isEmpty();
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 02b4ea20a7..41600d2143 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -125,12 +125,12 @@ static const QVariant::Handler widgets_handler = {
clear,
isNull,
#ifndef QT_NO_DATASTREAM
- 0,
- 0,
+ nullptr,
+ nullptr,
#endif
compare,
convert,
- 0,
+ nullptr,
#if !defined(QT_NO_DEBUG_STREAM)
streamDebug
#else
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 596343c52f..904067afda 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -57,10 +57,10 @@ QT_BEGIN_NAMESPACE
Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets();
-Q_WIDGETS_EXPORT QWidget *qt_button_down = 0; // widget got last button-down
+Q_WIDGETS_EXPORT QWidget *qt_button_down = nullptr; // widget got last button-down
// popup control
-QWidget *qt_popup_down = 0; // popup that contains the pressed widget
+QWidget *qt_popup_down = nullptr; // popup that contains the pressed widget
extern int openPopupCount;
bool qt_replay_popup_mouse_event = false;
extern bool qt_try_modal(QWidget *widget, QEvent::Type type);
@@ -156,7 +156,7 @@ QOpenGLContext *QWidgetWindowPrivate::shareContext() const
#endif // opengl
QWidgetWindow::QWidgetWindow(QWidget *widget)
- : QWindow(*new QWidgetWindowPrivate(), 0)
+ : QWindow(*new QWidgetWindowPrivate(), nullptr)
, m_widget(widget)
{
updateObjectName();
@@ -179,7 +179,7 @@ QAccessibleInterface *QWidgetWindow::accessibleRoot() const
{
if (m_widget)
return QAccessible::queryAccessibleInterface(m_widget);
- return 0;
+ return nullptr;
}
#endif
@@ -374,7 +374,7 @@ bool QWidgetWindow::event(QEvent *event)
#endif // QT_NO_CONTEXTMENU
case QEvent::WindowBlocked:
- qt_button_down = 0;
+ qt_button_down = nullptr;
break;
case QEvent::UpdateRequest:
@@ -393,7 +393,7 @@ bool QWidgetWindow::event(QEvent *event)
return QWindow::event(event);
}
-QPointer<QWidget> qt_last_mouse_receiver = 0;
+QPointer<QWidget> qt_last_mouse_receiver = nullptr;
void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
{
@@ -406,7 +406,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
return;
#endif
if (event->type() == QEvent::Leave) {
- QWidget *enter = 0;
+ QWidget *enter = nullptr;
// Check from window system event queue if the next queued enter targets a window
// in the same window hierarchy (e.g. enter a child of this window). If so,
// remove the enter event from queue and handle both in single dispatch.
@@ -484,13 +484,13 @@ QWidget *QWidgetWindow::getFocusWidget(FocusWidgets fw)
void QWidgetWindow::handleFocusInEvent(QFocusEvent *e)
{
- QWidget *focusWidget = 0;
+ QWidget *focusWidget = nullptr;
if (e->reason() == Qt::BacktabFocusReason)
focusWidget = getFocusWidget(LastFocusWidget);
else if (e->reason() == Qt::TabFocusReason)
focusWidget = getFocusWidget(FirstFocusWidget);
- if (focusWidget != 0)
+ if (focusWidget != nullptr)
focusWidget->setFocus();
}
@@ -513,8 +513,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QWidget *popupChild = activePopupWidget->childAt(mapped);
if (activePopupWidget != qt_popup_down) {
- qt_button_down = 0;
- qt_popup_down = 0;
+ qt_button_down = nullptr;
+ qt_popup_down = nullptr;
}
switch (event->type()) {
@@ -589,7 +589,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
&& qt_replay_popup_mouse_event
&& QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()) {
if (m_widget->windowType() != Qt::Popup)
- qt_button_down = 0;
+ qt_button_down = nullptr;
if (event->type() == QEvent::MouseButtonPress) {
// the popup disappeared, replay the mouse press event
QWidget *w = QApplication::widgetAt(event->globalPos());
@@ -636,8 +636,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
#endif
if (releaseAfter) {
- qt_button_down = 0;
- qt_popup_down = 0;
+ qt_button_down = nullptr;
+ qt_popup_down = nullptr;
}
return;
}
@@ -1050,7 +1050,7 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long
#if QT_CONFIG(tabletevent)
void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
{
- static QPointer<QWidget> qt_tablet_target = 0;
+ static QPointer<QWidget> qt_tablet_target = nullptr;
QWidget *widget = qt_tablet_target;
@@ -1076,7 +1076,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
}
if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton)
- qt_tablet_target = 0;
+ qt_tablet_target = nullptr;
}
#endif // QT_CONFIG(tabletevent)
@@ -1084,7 +1084,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e)
{
// copy-pasted code to find correct widget follows:
- QObject *receiver = 0;
+ QObject *receiver = nullptr;
if (QApplicationPrivate::inPopupMode()) {
QWidget *popup = QApplication::activePopupWidget();
QWidget *popupFocusWidget = popup->focusWidget();
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index fd8581edbb..b4d889fdfa 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -58,8 +58,8 @@ public:
Q_DECLARE_PUBLIC(QWindowContainer)
QWindowContainerPrivate()
- : window(0)
- , oldFocusWindow(0)
+ : window(nullptr)
+ , oldFocusWindow(nullptr)
, usesNativeWidgets(false)
{
}
@@ -70,7 +70,7 @@ public:
QWindowContainer *wc = qobject_cast<QWindowContainer *>(w);
if (wc)
return wc->d_func();
- return 0;
+ return nullptr;
}
void updateGeometry() {
@@ -90,7 +90,7 @@ public:
void updateUsesNativeWidgets()
{
- if (window->parent() == 0)
+ if (window->parent() == nullptr)
return;
Q_Q(QWindowContainer);
if (q->internalWinId()) {
@@ -295,7 +295,7 @@ bool QWindowContainer::event(QEvent *e)
case QEvent::ChildRemoved: {
QChildEvent *ce = static_cast<QChildEvent *>(e);
if (ce->child() == d->window)
- d->window = 0;
+ d->window = nullptr;
break;
}
// The only thing we are interested in is making sure our sizes stay
diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h
index c6de168c10..72474077aa 100644
--- a/src/widgets/kernel/qwindowcontainer_p.h
+++ b/src/widgets/kernel/qwindowcontainer_p.h
@@ -64,7 +64,7 @@ class Q_WIDGETS_EXPORT QWindowContainer : public QWidget
Q_DECLARE_PRIVATE(QWindowContainer)
public:
- explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
+ explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = nullptr, Qt::WindowFlags f = { });
~QWindowContainer();
QWindow *containedWindow() const;
diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri
index 3b3170beb1..eede987b4c 100644
--- a/src/widgets/kernel/win.pri
+++ b/src/widgets/kernel/win.pri
@@ -1,7 +1,6 @@
# Qt/Windows only configuration file
# --------------------------------------------------------------------
-INCLUDEPATH += ../3rdparty/wintab
!winrt {
LIBS_PRIVATE *= -luxtheme -ldwmapi
QMAKE_USE_PRIVATE += shell32