summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/dialogs/qdialog.cpp6
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp4
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp2
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp4
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp32
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp24
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp56
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp46
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp10
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp18
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp4
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.cpp6
-rw-r--r--src/widgets/kernel/qaction.cpp44
-rw-r--r--src/widgets/kernel/qapplication.cpp50
-rw-r--r--src/widgets/kernel/qboxlayout.cpp2
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp4
-rw-r--r--src/widgets/kernel/qlayout.cpp4
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp4
-rw-r--r--src/widgets/kernel/qshortcut.cpp14
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp14
-rw-r--r--src/widgets/kernel/qwidget.cpp162
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp6
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp12
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp20
-rw-r--r--src/widgets/styles/qstyle.cpp4
-rw-r--r--src/widgets/styles/qstyleoption.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp6
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp11
-rw-r--r--src/widgets/util/qcompleter.cpp2
-rw-r--r--src/widgets/util/qflickgesture.cpp8
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp4
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp6
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp6
-rw-r--r--src/widgets/widgets/qcombobox.cpp4
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp8
-rw-r--r--src/widgets/widgets/qdockwidget.cpp2
-rw-r--r--src/widgets/widgets/qeffects.cpp8
-rw-r--r--src/widgets/widgets/qlineedit.cpp19
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp6
-rw-r--r--src/widgets/widgets/qmenu.cpp30
-rw-r--r--src/widgets/widgets/qmenubar.cpp4
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp4
-rw-r--r--src/widgets/widgets/qspinbox.cpp8
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp6
-rw-r--r--src/widgets/widgets/qtabbar.cpp2
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp10
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp20
58 files changed, 376 insertions, 374 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 5692a16bce..3cdd9a5f04 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -282,7 +282,7 @@ void QDialogPrivate::deletePlatformHelper()
progress dialogs, where the user must have the ability to interact
with the dialog, e.g. to cancel a long running operation. If you
use show() and setModal(true) together to perform a long operation,
- you must call QApplication::processEvents() periodically during
+ you must call QCoreApplication::processEvents() periodically during
processing to enable the user to interact with the dialog. (See
QProgressDialog.)
@@ -691,7 +691,7 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e)
if (p.data()->exec(e->globalPos()) == wt) {
QHelpEvent e(QEvent::WhatsThis, w->rect().center(),
w->mapToGlobal(w->rect().center()));
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
}
delete p.data();
}
@@ -826,7 +826,7 @@ QT_WARNING_POP
#endif
if (fw && !fw->hasFocus()) {
QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason);
- QApplication::sendEvent(fw, &e);
+ QCoreApplication::sendEvent(fw, &e);
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 51a3e080bf..f0ec2c0102 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -295,7 +295,7 @@ QErrorMessage * QErrorMessage::qtHandler()
if (!qtMessageHandler) {
qtMessageHandler = new QErrorMessage(0);
qAddPostRoutine(deleteStaticcQErrorMessage); // clean up
- qtMessageHandler->setWindowTitle(QApplication::applicationName());
+ qtMessageHandler->setWindowTitle(QCoreApplication::applicationName());
qInstallMessageHandler(jump);
}
return qtMessageHandler;
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index a778fd3a45..b521f50f40 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -1390,7 +1390,7 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
if (d->rootDir.path() == longNewPath)
return d->index(rootPath());
- bool showDrives = (longNewPath.isEmpty() || longNewPath == d->myComputer());
+ bool showDrives = (longNewPath.isEmpty() || longNewPath == QFileSystemModelPrivate::myComputer());
if (!showDrives && !newPathDir.exists())
return d->index(rootPath());
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 2b81180ecb..cd296ca020 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -432,7 +432,7 @@ bool QFontDialog::eventFilter(QObject *o , QEvent *e)
k->key() == Qt::Key_PageDown)) {
int ci = d->sizeList->currentItem();
- (void)QApplication::sendEvent(d->sizeList, k);
+ QCoreApplication::sendEvent(d->sizeList, k);
if (ci != d->sizeList->currentItem()
&& style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this))
@@ -680,7 +680,7 @@ void QFontDialogPrivate::updateSampleFont(const QFont &newFont)
void QFontDialogPrivate::_q_writingSystemHighlighted(int index)
{
writingSystem = QFontDatabase::WritingSystem(index);
- sampleEdit->setText(fdb.writingSystemSample(writingSystem));
+ sampleEdit->setText(QFontDatabase::writingSystemSample(writingSystem));
updateFamilies();
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 9bfea06a54..8dad212692 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1508,7 +1508,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
if (d->detailsText)
textToCopy += d->detailsText->text() + QLatin1Char('\n') + separator;
#endif
- QApplication::clipboard()->setText(textToCopy);
+ QGuiApplication::clipboard()->setText(textToCopy);
return;
}
#endif // Q_OS_WIN
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 078dd6463b..e1a6bce5b1 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -643,7 +643,7 @@ int QProgressDialog::value() const
\warning If the progress dialog is modal
(see QProgressDialog::QProgressDialog()),
- setValue() calls QApplication::processEvents(), so take care that
+ setValue() calls QCoreApplication::processEvents(), so take care that
this does not cause undesirable re-entrancy in your code. For example,
don't use a QProgressDialog inside a paintEvent()!
@@ -659,7 +659,7 @@ void QProgressDialog::setValue(int progress)
if (d->shown_once) {
if (isModal())
- QApplication::processEvents();
+ QCoreApplication::processEvents();
} else {
if ((!d->setValue_called && progress == 0 /* for compat with Qt < 5.4 */) || progress == minimum()) {
d->starttime.start();
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index f428114bbe..4d28dda7c7 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -2577,7 +2577,7 @@ void QWizard::setWizardStyle(WizardStyle style)
//Send a resizeevent since the antiflicker widget probably needs a new size
//because of the backbutton in the window title
QResizeEvent ev(geometry().size(), geometry().size());
- QApplication::sendEvent(this, &ev);
+ QCoreApplication::sendEvent(this, &ev);
}
#endif
d->updateLayout();
diff --git a/src/widgets/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp
index ca0aef9e27..8b52b57580 100644
--- a/src/widgets/graphicsview/qgraphicslayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout.cpp
@@ -338,7 +338,7 @@ void QGraphicsLayout::invalidate()
}
if (layoutItem && !layoutItem->isLayout()) {
// If a layout has a parent that is not a layout it must be a QGraphicsWidget.
- QApplication::postEvent(static_cast<QGraphicsWidget *>(layoutItem), new QEvent(QEvent::LayoutRequest));
+ QCoreApplication::postEvent(static_cast<QGraphicsWidget *>(layoutItem), new QEvent(QEvent::LayoutRequest));
}
}
}
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp
index ae1eeffa2b..59ed7acd72 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout_p.cpp
@@ -108,7 +108,7 @@ Qt::LayoutDirection QGraphicsLayoutPrivate::visualDirection() const
if (maybeWidget->isWidget())
return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection();
}
- return QApplication::layoutDirection();
+ return QGuiApplication::layoutDirection();
}
static bool removeLayoutItemFromLayout(QGraphicsLayout *lay, QGraphicsLayoutItem *layoutItem)
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index e9f092020f..f1b01fbb4d 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -342,7 +342,7 @@ void QGraphicsProxyWidgetPrivate::sendWidgetKeyEvent(QKeyEvent *event)
Q_ASSERT(receiver);
do {
- bool res = QApplication::sendEvent(receiver, event);
+ bool res = QCoreApplication::sendEvent(receiver, event);
if ((res && event->isAccepted()) || (q->isWindow() && receiver == widget))
break;
receiver = receiver->parentWidget();
@@ -356,9 +356,9 @@ void QGraphicsProxyWidgetPrivate::removeSubFocusHelper(QWidget *widget, Qt::Focu
{
QFocusEvent event(QEvent::FocusOut, reason);
QPointer<QWidget> widgetGuard = widget;
- QApplication::sendEvent(widget, &event);
+ QCoreApplication::sendEvent(widget, &event);
if (widgetGuard && event.isAccepted())
- QApplication::sendEvent(widget->style(), &event);
+ QCoreApplication::sendEvent(widget->style(), &event);
}
/*!
@@ -865,7 +865,7 @@ bool QGraphicsProxyWidget::event(QEvent *event)
case QEvent::ShortcutOverride: {
QWidget *focusWidget = d->widget->focusWidget();
while (focusWidget) {
- QApplication::sendEvent(focusWidget, event);
+ QCoreApplication::sendEvent(focusWidget, event);
if (event->isAccepted())
return true;
focusWidget = focusWidget->parentWidget();
@@ -878,7 +878,7 @@ bool QGraphicsProxyWidget::event(QEvent *event)
if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier?
QWidget *focusWidget = d->widget->focusWidget();
while (focusWidget) {
- bool res = QApplication::sendEvent(focusWidget, event);
+ const bool res = QCoreApplication::sendEvent(focusWidget, event);
if ((res && event->isAccepted()) || (isWindow() && focusWidget == d->widget)) {
event->accept();
break;
@@ -897,7 +897,7 @@ bool QGraphicsProxyWidget::event(QEvent *event)
QGraphicsSceneHelpEvent *he = static_cast<QGraphicsSceneHelpEvent *>(event);
QPoint pos = d->mapToReceiver(mapFromScene(he->scenePos()), d->lastWidgetUnderMouse).toPoint();
QHelpEvent e(QEvent::ToolTip, pos, he->screenPos());
- QApplication::sendEvent(d->lastWidgetUnderMouse, &e);
+ QCoreApplication::sendEvent(d->lastWidgetUnderMouse, &e);
event->setAccepted(e.isAccepted());
return e.isAccepted();
}
@@ -919,7 +919,7 @@ bool QGraphicsProxyWidget::event(QEvent *event)
if (event->spontaneous())
qt_sendSpontaneousEvent(d->widget, event);
else
- QApplication::sendEvent(d->widget, event);
+ QCoreApplication::sendEvent(d->widget, event);
if (event->isAccepted())
return true;
@@ -1044,7 +1044,7 @@ void QGraphicsProxyWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
// Send mouse event. ### Doesn't propagate the event.
QContextMenuEvent contextMenuEvent(QContextMenuEvent::Reason(event->reason()),
pos.toPoint(), globalPos, event->modifiers());
- QApplication::sendEvent(receiver, &contextMenuEvent);
+ QCoreApplication::sendEvent(receiver, &contextMenuEvent);
event->setAccepted(contextMenuEvent.isAccepted());
}
@@ -1065,7 +1065,7 @@ void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
QDragEnterEvent proxyDragEnter(event->pos().toPoint(), event->dropAction(), event->mimeData(), event->buttons(), event->modifiers());
proxyDragEnter.setAccepted(event->isAccepted());
- QApplication::sendEvent(d->widget, &proxyDragEnter);
+ QCoreApplication::sendEvent(d->widget, &proxyDragEnter);
event->setAccepted(proxyDragEnter.isAccepted());
if (proxyDragEnter.isAccepted()) // we discard answerRect
event->setDropAction(proxyDragEnter.dropAction());
@@ -1082,7 +1082,7 @@ void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
if (!d->widget || !d->dragDropWidget)
return;
QDragLeaveEvent proxyDragLeave;
- QApplication::sendEvent(d->dragDropWidget, &proxyDragLeave);
+ QCoreApplication::sendEvent(d->dragDropWidget, &proxyDragLeave);
d->dragDropWidget = 0;
#endif
}
@@ -1112,7 +1112,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
// Try to enter before we leave
QDragEnterEvent dragEnter(receiverPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
dragEnter.setDropAction(event->proposedAction());
- QApplication::sendEvent(receiver, &dragEnter);
+ QCoreApplication::sendEvent(receiver, &dragEnter);
event->setAccepted(dragEnter.isAccepted());
event->setDropAction(dragEnter.dropAction());
if (!event->isAccepted()) {
@@ -1124,14 +1124,14 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
if (d->dragDropWidget) {
QDragLeaveEvent dragLeave;
- QApplication::sendEvent(d->dragDropWidget, &dragLeave);
+ QCoreApplication::sendEvent(d->dragDropWidget, &dragLeave);
}
d->dragDropWidget = receiver;
}
QDragMoveEvent dragMove(receiverPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
event->setDropAction(d->lastDropAction);
- QApplication::sendEvent(receiver, &dragMove);
+ QCoreApplication::sendEvent(receiver, &dragMove);
event->setAccepted(dragMove.isAccepted());
event->setDropAction(dragMove.dropAction());
if (event->isAccepted())
@@ -1144,7 +1144,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
if (d->dragDropWidget) {
// Leave the last drag drop item
QDragLeaveEvent dragLeave;
- QApplication::sendEvent(d->dragDropWidget, &dragLeave);
+ QCoreApplication::sendEvent(d->dragDropWidget, &dragLeave);
d->dragDropWidget = 0;
}
// Propagate
@@ -1165,7 +1165,7 @@ void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event)
if (d->widget && d->dragDropWidget) {
QPoint widgetPos = d->mapToReceiver(event->pos(), d->dragDropWidget).toPoint();
QDropEvent dropEvent(widgetPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
- QApplication::sendEvent(d->dragDropWidget, &dropEvent);
+ QCoreApplication::sendEvent(d->dragDropWidget, &dropEvent);
event->setAccepted(dropEvent.isAccepted());
d->dragDropWidget = 0;
}
@@ -1464,7 +1464,7 @@ void QGraphicsProxyWidget::inputMethodEvent(QInputMethodEvent *event)
Q_D(const QGraphicsProxyWidget);
QWidget *focusWidget = d->widget->focusWidget();
if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
- QApplication::sendEvent(focusWidget, event);
+ QCoreApplication::sendEvent(focusWidget, event);
}
/*!
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index e5bd65d61e..2cdbdc2072 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -114,7 +114,7 @@
Another responsibility that QGraphicsScene has, is to propagate events
from QGraphicsView. To send an event to a scene, you construct an event
that inherits QEvent, and then send it using, for example,
- QApplication::sendEvent(). event() is responsible for dispatching
+ QCoreApplication::sendEvent(). event() is responsible for dispatching
the event to the individual items. Some common events are handled by
convenience event handlers. For example, key press events are handled by
keyPressEvent(), and mouse press events are handled by mousePressEvent().
@@ -451,7 +451,7 @@ void QGraphicsScenePrivate::_q_polishItems()
}
if (itemd->isWidget) {
QEvent event(QEvent::Polish);
- QApplication::sendEvent((QGraphicsWidget *)item, &event);
+ QCoreApplication::sendEvent((QGraphicsWidget *)item, &event);
}
}
@@ -774,7 +774,7 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin
// Update activate state.
activePanel = panel;
QEvent event(QEvent::ActivationChange);
- QApplication::sendEvent(q, &event);
+ QCoreApplication::sendEvent(q, &event);
// Activate
if (panel) {
@@ -1243,7 +1243,7 @@ bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event)
return false;
if (QGraphicsObject *o = item->toGraphicsObject()) {
bool spont = event->spontaneous();
- if (spont ? qt_sendSpontaneousEvent(o, event) : QApplication::sendEvent(o, event))
+ if (spont ? qt_sendSpontaneousEvent(o, event) : QCoreApplication::sendEvent(o, event))
return true;
event->spont = spont;
}
@@ -1569,7 +1569,7 @@ void QGraphicsScenePrivate::updateFont(const QFont &font)
// Send the scene a FontChange event.
QEvent event(QEvent::FontChange);
- QApplication::sendEvent(q, &event);
+ QCoreApplication::sendEvent(q, &event);
}
/*!
@@ -1593,7 +1593,7 @@ void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette)
*/
void QGraphicsScenePrivate::resolvePalette()
{
- QPalette naturalPalette = QApplication::palette();
+ QPalette naturalPalette = QGuiApplication::palette();
naturalPalette.resolve(0);
QPalette resolvedPalette = palette.resolve(naturalPalette);
updatePalette(resolvedPalette);
@@ -1626,7 +1626,7 @@ void QGraphicsScenePrivate::updatePalette(const QPalette &palette)
// Send the scene a PaletteChange event.
QEvent event(QEvent::PaletteChange);
- QApplication::sendEvent(q, &event);
+ QCoreApplication::sendEvent(q, &event);
}
/*!
@@ -3548,10 +3548,10 @@ bool QGraphicsScene::eventFilter(QObject *watched, QEvent *event)
switch (event->type()) {
case QEvent::ApplicationPaletteChange:
- QApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange));
+ QCoreApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange));
break;
case QEvent::ApplicationFontChange:
- QApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange));
+ QCoreApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange));
break;
default:
break;
@@ -5605,7 +5605,7 @@ void QGraphicsScene::setStyle(QStyle *style)
// Notify the scene.
QEvent event(QEvent::StyleChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
// Notify all widgets that don't have a style explicitly set.
const auto items_ = items();
@@ -5613,7 +5613,7 @@ void QGraphicsScene::setStyle(QStyle *style)
if (item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
if (!widget->testAttribute(Qt::WA_SetStyle))
- QApplication::sendEvent(widget, &event);
+ QCoreApplication::sendEvent(widget, &event);
}
}
}
@@ -5686,7 +5686,7 @@ QPalette QGraphicsScene::palette() const
void QGraphicsScene::setPalette(const QPalette &palette)
{
Q_D(QGraphicsScene);
- QPalette naturalPalette = QApplication::palette();
+ QPalette naturalPalette = QGuiApplication::palette();
naturalPalette.resolve(0);
QPalette resolvedPalette = palette.resolve(naturalPalette);
d->setPalette_helper(resolvedPalette);
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 5fe520132f..3ec9668cde 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -667,7 +667,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
if (event->spontaneous())
qt_sendSpontaneousEvent(scene, &mouseEvent);
else
- QApplication::sendEvent(scene, &mouseEvent);
+ QCoreApplication::sendEvent(scene, &mouseEvent);
// Remember whether the last event was accepted or not.
lastMouseEvent.setAccepted(mouseEvent.isAccepted());
@@ -1716,7 +1716,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
if (isActiveWindow() && isVisible()) {
QEvent windowDeactivate(QEvent::WindowDeactivate);
- QApplication::sendEvent(d->scene, &windowDeactivate);
+ QCoreApplication::sendEvent(d->scene, &windowDeactivate);
}
if(hasFocus())
d->scene->clearFocus();
@@ -1744,7 +1744,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
if (isActiveWindow() && isVisible()) {
QEvent windowActivate(QEvent::WindowActivate);
- QApplication::sendEvent(d->scene, &windowActivate);
+ QCoreApplication::sendEvent(d->scene, &windowActivate);
}
} else {
d->recalculateContentSize();
@@ -2809,7 +2809,7 @@ bool QGraphicsView::event(QEvent *event)
switch (event->type()) {
case QEvent::ShortcutOverride:
if (d->scene)
- return QApplication::sendEvent(d->scene, event);
+ return QCoreApplication::sendEvent(d->scene, event);
break;
case QEvent::KeyPress:
if (d->scene) {
@@ -2821,7 +2821,7 @@ bool QGraphicsView::event(QEvent *event)
// and the base implementation will call QGraphicsView's
// focusNextPrevChild() function. If the event is ignored,
// we fall back to standard tab focus handling.
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
if (event->isAccepted())
return true;
// Ensure the event doesn't propagate just because the
@@ -2850,10 +2850,10 @@ bool QGraphicsView::viewportEvent(QEvent *event)
switch (event->type()) {
case QEvent::Enter:
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
break;
case QEvent::WindowActivate:
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
break;
case QEvent::WindowDeactivate:
// ### This is a temporary fix for until we get proper mouse
@@ -2862,19 +2862,19 @@ bool QGraphicsView::viewportEvent(QEvent *event)
// Remove all popups when the scene loses focus.
if (!d->scene->d_func()->popupWidgets.isEmpty())
d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.constFirst());
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
break;
case QEvent::Show:
if (d->scene && isActiveWindow()) {
QEvent windowActivate(QEvent::WindowActivate);
- QApplication::sendEvent(d->scene, &windowActivate);
+ QCoreApplication::sendEvent(d->scene, &windowActivate);
}
break;
case QEvent::Hide:
// spontaneous event will generate a WindowDeactivate.
if (!event->spontaneous() && d->scene && isActiveWindow()) {
QEvent windowDeactivate(QEvent::WindowDeactivate);
- QApplication::sendEvent(d->scene, &windowDeactivate);
+ QCoreApplication::sendEvent(d->scene, &windowDeactivate);
}
break;
case QEvent::Leave: {
@@ -2892,7 +2892,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
Q_ASSERT(event->d == 0);
QScopedValueRollback<QEventPrivate *> rb(event->d);
event->d = reinterpret_cast<QEventPrivate *>(viewport());
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
break;
}
#ifndef QT_NO_TOOLTIP
@@ -2902,7 +2902,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
helpEvent.setWidget(viewport());
helpEvent.setScreenPos(toolTip->globalPos());
helpEvent.setScenePos(mapToScene(toolTip->pos()));
- QApplication::sendEvent(d->scene, &helpEvent);
+ QCoreApplication::sendEvent(d->scene, &helpEvent);
toolTip->setAccepted(helpEvent.isAccepted());
return true;
}
@@ -2940,7 +2940,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
touchEvent->setTarget(viewport());
QGraphicsViewPrivate::translateTouchEvent(d, touchEvent);
- (void) QApplication::sendEvent(d->scene, touchEvent);
+ QCoreApplication::sendEvent(d->scene, touchEvent);
} else {
event->ignore();
}
@@ -2957,7 +2957,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
if (d->scene && d->sceneInteractionAllowed) {
QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(event);
gestureEvent->setWidget(viewport());
- (void) QApplication::sendEvent(d->scene, gestureEvent);
+ QCoreApplication::sendEvent(d->scene, gestureEvent);
}
return true;
}
@@ -2992,7 +2992,7 @@ void QGraphicsView::contextMenuEvent(QContextMenuEvent *event)
contextEvent.setModifiers(event->modifiers());
contextEvent.setReason((QGraphicsSceneContextMenuEvent::Reason)(event->reason()));
contextEvent.setAccepted(event->isAccepted());
- QApplication::sendEvent(d->scene, &contextEvent);
+ QCoreApplication::sendEvent(d->scene, &contextEvent);
event->setAccepted(contextEvent.isAccepted());
}
#endif // QT_NO_CONTEXTMENU
@@ -3012,7 +3012,7 @@ void QGraphicsView::dropEvent(QDropEvent *event)
d->populateSceneDragDropEvent(&sceneEvent, event);
// Send it to the scene.
- QApplication::sendEvent(d->scene, &sceneEvent);
+ QCoreApplication::sendEvent(d->scene, &sceneEvent);
// Accept the originating event if the scene accepted the scene event.
event->setAccepted(sceneEvent.isAccepted());
@@ -3043,7 +3043,7 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event)
d->storeDragDropEvent(&sceneEvent);
// Send it to the scene.
- QApplication::sendEvent(d->scene, &sceneEvent);
+ QCoreApplication::sendEvent(d->scene, &sceneEvent);
// Accept the originating event if the scene accepted the scene event.
if (sceneEvent.isAccepted()) {
@@ -3081,7 +3081,7 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event)
d->lastDragDropEvent = 0;
// Send it to the scene.
- QApplication::sendEvent(d->scene, &sceneEvent);
+ QCoreApplication::sendEvent(d->scene, &sceneEvent);
// Accept the originating event if the scene accepted the scene event.
if (sceneEvent.isAccepted())
@@ -3105,7 +3105,7 @@ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event)
d->storeDragDropEvent(&sceneEvent);
// Send it to the scene.
- QApplication::sendEvent(d->scene, &sceneEvent);
+ QCoreApplication::sendEvent(d->scene, &sceneEvent);
// Ignore the originating event if the scene ignored the scene event.
event->setAccepted(sceneEvent.isAccepted());
@@ -3123,7 +3123,7 @@ void QGraphicsView::focusInEvent(QFocusEvent *event)
d->updateInputMethodSensitivity();
QAbstractScrollArea::focusInEvent(event);
if (d->scene)
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
// Pass focus on if the scene cannot accept focus.
if (!d->scene || !event->isAccepted())
QAbstractScrollArea::focusInEvent(event);
@@ -3145,7 +3145,7 @@ void QGraphicsView::focusOutEvent(QFocusEvent *event)
Q_D(QGraphicsView);
QAbstractScrollArea::focusOutEvent(event);
if (d->scene)
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
}
/*!
@@ -3158,7 +3158,7 @@ void QGraphicsView::keyPressEvent(QKeyEvent *event)
QAbstractScrollArea::keyPressEvent(event);
return;
}
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
if (!event->isAccepted())
QAbstractScrollArea::keyPressEvent(event);
}
@@ -3171,7 +3171,7 @@ void QGraphicsView::keyReleaseEvent(QKeyEvent *event)
Q_D(QGraphicsView);
if (!d->scene || !d->sceneInteractionAllowed)
return;
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
if (!event->isAccepted())
QAbstractScrollArea::keyReleaseEvent(event);
}
@@ -3210,7 +3210,7 @@ void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
if (event->spontaneous())
qt_sendSpontaneousEvent(d->scene, &mouseEvent);
else
- QApplication::sendEvent(d->scene, &mouseEvent);
+ QCoreApplication::sendEvent(d->scene, &mouseEvent);
// Update the original mouse event accepted state.
const bool isAccepted = mouseEvent.isAccepted();
@@ -3261,7 +3261,7 @@ void QGraphicsView::mousePressEvent(QMouseEvent *event)
if (event->spontaneous())
qt_sendSpontaneousEvent(d->scene, &mouseEvent);
else
- QApplication::sendEvent(d->scene, &mouseEvent);
+ QCoreApplication::sendEvent(d->scene, &mouseEvent);
// Update the original mouse event accepted state.
bool isAccepted = mouseEvent.isAccepted();
@@ -3397,7 +3397,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
if (event->spontaneous())
qt_sendSpontaneousEvent(d->scene, &mouseEvent);
else
- QApplication::sendEvent(d->scene, &mouseEvent);
+ QCoreApplication::sendEvent(d->scene, &mouseEvent);
// Update the last mouse event selected state.
d->lastMouseEvent.setAccepted(mouseEvent.isAccepted());
@@ -3433,7 +3433,7 @@ void QGraphicsView::wheelEvent(QWheelEvent *event)
wheelEvent.setDelta(event->delta());
wheelEvent.setOrientation(event->orientation());
wheelEvent.setAccepted(false);
- QApplication::sendEvent(d->scene, &wheelEvent);
+ QCoreApplication::sendEvent(d->scene, &wheelEvent);
event->setAccepted(wheelEvent.isAccepted());
if (!event->isAccepted())
QAbstractScrollArea::wheelEvent(event);
@@ -3720,7 +3720,7 @@ void QGraphicsView::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QGraphicsView);
if (d->scene)
- QApplication::sendEvent(d->scene, event);
+ QCoreApplication::sendEvent(d->scene, event);
}
/*!
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index cd647a5db1..643f073085 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -390,7 +390,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
QGraphicsSceneMoveEvent event;
event.setOldPos(oldPos);
event.setNewPos(pos());
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
if (wd->inSetPos) {
//set the new pos
d->geom.moveTopLeft(pos());
@@ -413,10 +413,10 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
QGraphicsLayout *lay = wd->layout;
if (QGraphicsLayout::instantInvalidatePropagation()) {
if (!lay || lay->isActivated()) {
- QApplication::sendEvent(this, &re);
+ QCoreApplication::sendEvent(this, &re);
}
} else {
- QApplication::sendEvent(this, &re);
+ QCoreApplication::sendEvent(this, &re);
}
}
}
@@ -427,7 +427,7 @@ relayoutChildrenAndReturn:
if (QGraphicsLayout *lay = wd->layout) {
if (!lay->isActivated()) {
QEvent layoutRequest(QEvent::LayoutRequest);
- QApplication::sendEvent(this, &layoutRequest);
+ QCoreApplication::sendEvent(this, &layoutRequest);
}
}
}
@@ -507,7 +507,7 @@ void QGraphicsWidget::setContentsMargins(QMarginsF margins)
updateGeometry();
QEvent e(QEvent::ContentsRectChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
/*!
@@ -963,7 +963,7 @@ void QGraphicsWidget::setStyle(QStyle *style)
// Deliver StyleChange to the widget itself (doesn't propagate).
QEvent event(QEvent::StyleChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
/*!
@@ -1028,7 +1028,7 @@ void QGraphicsWidget::setFont(const QFont &font)
By default, this property contains the application's default palette.
- \sa QApplication::palette(), QGraphicsScene::palette, QPalette::resolve()
+ \sa QGuiApplication::palette(), QGraphicsScene::palette, QPalette::resolve()
*/
QPalette QGraphicsWidget::palette() const
{
@@ -1100,7 +1100,7 @@ void QGraphicsWidget::updateGeometry()
// This is for custom layouting
QGraphicsWidget *parentWid = parentWidget(); //###
if (parentWid->isVisible())
- QApplication::postEvent(parentWid, new QEvent(QEvent::LayoutRequest));
+ QCoreApplication::postEvent(parentWid, new QEvent(QEvent::LayoutRequest));
} else {
/**
* If this is the topmost widget, post a LayoutRequest event to the widget.
@@ -1108,7 +1108,7 @@ void QGraphicsWidget::updateGeometry()
* widgets in one go. This will make a relayout flicker-free.
*/
if (QGraphicsLayout::instantInvalidatePropagation())
- QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest));
+ QCoreApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest));
}
if (!QGraphicsLayout::instantInvalidatePropagation()) {
bool wasResized = testAttribute(Qt::WA_Resized);
@@ -1145,14 +1145,14 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
case ItemEnabledHasChanged: {
// Send EnabledChange after the enabled state has changed.
QEvent event(QEvent::EnabledChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
break;
}
case ItemVisibleChange:
if (value.toBool()) {
// Send Show event before the item has been shown.
QShowEvent event;
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
bool resized = testAttribute(Qt::WA_Resized);
if (!resized) {
adjustSize();
@@ -1168,7 +1168,7 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
if (!value.toBool()) {
// Send Hide event after the item has been hidden.
QHideEvent event;
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
break;
case ItemPositionHasChanged:
@@ -1177,25 +1177,25 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
case ItemParentChange: {
// Deliver ParentAboutToChange.
QEvent event(QEvent::ParentAboutToChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
break;
}
case ItemParentHasChanged: {
// Deliver ParentChange.
QEvent event(QEvent::ParentChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
break;
}
case ItemCursorHasChanged: {
// Deliver CursorChange.
QEvent event(QEvent::CursorChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
break;
}
case ItemToolTipHasChanged: {
// Deliver ToolTipChange.
QEvent event(QEvent::ToolTipChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
break;
}
default:
@@ -1930,7 +1930,7 @@ int QGraphicsWidget::grabShortcut(const QKeySequence &sequence, Qt::ShortcutCont
if (sequence.isEmpty())
return 0;
// ### setAttribute(Qt::WA_GrabbedShortcut);
- return qApp->d_func()->shortcutMap.addShortcut(this, sequence, context, qWidgetShortcutContextMatcher);
+ return QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, sequence, context, qWidgetShortcutContextMatcher);
}
/*!
@@ -1954,7 +1954,7 @@ void QGraphicsWidget::releaseShortcut(int id)
{
Q_ASSERT(qApp);
if (id)
- qApp->d_func()->shortcutMap.removeShortcut(id, this, 0);
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this, 0);
}
/*!
@@ -1975,7 +1975,7 @@ void QGraphicsWidget::setShortcutEnabled(int id, bool enabled)
{
Q_ASSERT(qApp);
if (id)
- qApp->d_func()->shortcutMap.setShortcutEnabled(enabled, id, this, 0);
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enabled, id, this, 0);
}
/*!
@@ -1990,7 +1990,7 @@ void QGraphicsWidget::setShortcutAutoRepeat(int id, bool enabled)
{
Q_ASSERT(qApp);
if (id)
- qApp->d_func()->shortcutMap.setShortcutAutoRepeat(enabled, id, this, 0);
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(enabled, id, this, 0);
}
#endif
@@ -2068,7 +2068,7 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action)
}
QActionEvent e(QEvent::ActionAdded, action, before);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
/*!
@@ -2111,7 +2111,7 @@ void QGraphicsWidget::removeAction(QAction *action)
if (d->actions.removeAll(action)) {
QActionEvent e(QEvent::ActionRemoved, action);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
}
@@ -2404,7 +2404,7 @@ QPainterPath QGraphicsWidget::shape() const
bool QGraphicsWidget::close()
{
QCloseEvent closeEvent;
- QApplication::sendEvent(this, &closeEvent);
+ QCoreApplication::sendEvent(this, &closeEvent);
if (!closeEvent.isAccepted()) {
return false;
}
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index ce027c1319..cc08b1c566 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -190,7 +190,7 @@ void QGraphicsWidgetPrivate::updatePalette(const QPalette &palette)
// Notify change.
QEvent event(QEvent::PaletteChange);
- QApplication::sendEvent(q, &event);
+ QCoreApplication::sendEvent(q, &event);
}
void QGraphicsWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction)
@@ -212,7 +212,7 @@ void QGraphicsWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direc
// Send the notification event to this widget item.
QEvent e(QEvent::LayoutDirectionChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
void QGraphicsWidgetPrivate::resolveLayoutDirection()
@@ -226,9 +226,9 @@ void QGraphicsWidgetPrivate::resolveLayoutDirection()
} else if (scene) {
// ### shouldn't the scene have a layoutdirection really? how does
// ### QGraphicsWidget get changes from QApplication::layoutDirection?
- setLayoutDirection_helper(QApplication::layoutDirection());
+ setLayoutDirection_helper(QGuiApplication::layoutDirection());
} else {
- setLayoutDirection_helper(QApplication::layoutDirection());
+ setLayoutDirection_helper(QGuiApplication::layoutDirection());
}
}
@@ -290,7 +290,7 @@ void QGraphicsWidgetPrivate::updateFont(const QFont &font)
return;
// Notify change.
QEvent event(QEvent::FontChange);
- QApplication::sendEvent(q, &event);
+ QCoreApplication::sendEvent(q, &event);
}
QFont QGraphicsWidgetPrivate::naturalWidgetFont() const
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 1d1c144bb8..6ff0fe8132 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -180,7 +180,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index
QString statustip = model->data(index, Qt::StatusTipRole).toString();
if (parent && (shouldClearStatusTip || !statustip.isEmpty())) {
QStatusTipEvent tip(statustip);
- QApplication::sendEvent(parent, &tip);
+ QCoreApplication::sendEvent(parent, &tip);
shouldClearStatusTip = !statustip.isEmpty();
}
#endif
@@ -189,7 +189,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index
if (parent && shouldClearStatusTip) {
QString emptyString;
QStatusTipEvent tip( emptyString );
- QApplication::sendEvent(parent, &tip);
+ QCoreApplication::sendEvent(parent, &tip);
}
#endif
emit q->viewportEntered();
@@ -521,7 +521,7 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged()
the mouse was pressed on is specified by \a index. The signal is
only emitted when the index is valid.
- Use the QApplication::mouseButtons() function to get the state
+ Use the QGuiApplication::mouseButtons() function to get the state
of the mouse buttons.
\sa activated(), clicked(), doubleClicked(), entered()
@@ -1713,7 +1713,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
if (d->shouldClearStatusTip && d->parent) {
QString empty;
QStatusTipEvent tip(empty);
- QApplication::sendEvent(d->parent, &tip);
+ QCoreApplication::sendEvent(d->parent, &tip);
d->shouldClearStatusTip = false;
}
#endif
@@ -2338,7 +2338,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (d->model)
variant = d->model->data(currentIndex(), Qt::DisplayRole);
if (variant.type() == QVariant::String)
- QApplication::clipboard()->setText(variant.toString());
+ QGuiApplication::clipboard()->setText(variant.toString());
event->accept();
}
#endif
@@ -2845,7 +2845,7 @@ void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndE
}
QPointer<QWidget> ed = editor;
- QApplication::sendPostedEvents(editor, 0);
+ QCoreApplication::sendPostedEvents(editor, 0);
editor = ed;
if (!isPersistent && editor)
@@ -3957,7 +3957,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QM
keyModifiers = (static_cast<const QInputEvent*>(event))->modifiers();
break;
default:
- keyModifiers = QApplication::keyboardModifiers();
+ keyModifiers = QGuiApplication::keyboardModifiers();
}
}
switch (d->selectionMode) {
@@ -4015,7 +4015,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionComm
QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionCommand(
const QModelIndex &index, const QEvent *event) const
{
- Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
+ Qt::KeyboardModifiers modifiers = QGuiApplication::keyboardModifiers();
if (event) {
switch (event->type()) {
case QEvent::MouseMove: {
@@ -4425,7 +4425,7 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
w->setFocus();
if (event)
- QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event);
+ QCoreApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event);
return true;
}
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index b94c31fb42..13a1bbd8eb 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1086,7 +1086,7 @@ QString QDirModel::filePath(const QModelIndex &index) const
if (d->indexValid(index)) {
QFileInfo fi = fileInfo(index);
if (d->resolveSymlinks && fi.isSymLink())
- fi = d->resolvedInfo(fi);
+ fi = QDirModelPrivate::resolvedInfo(fi);
return QDir::cleanPath(fi.absoluteFilePath());
}
return QString(); // root path
@@ -1108,7 +1108,7 @@ QString QDirModel::fileName(const QModelIndex &index) const
if (QFileSystemEntry::isRootPath(path))
return path;
if (d->resolveSymlinks && info.isSymLink())
- info = d->resolvedInfo(info);
+ info = QDirModelPrivate::resolvedInfo(info);
return info.fileName();
}
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 1fcd5bdef2..be80843b07 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2896,7 +2896,7 @@ bool QHeaderView::viewportEvent(QEvent *e)
case QEvent::Wheel: {
QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea *>(parentWidget());
if (asa)
- return QApplication::sendEvent(asa->viewport(), e);
+ return QCoreApplication::sendEvent(asa->viewport(), e);
break; }
default:
break;
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 641b15f85b..25facd1484 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -821,13 +821,13 @@ void QListView::wheelEvent(QWheelEvent *e)
if (e->spontaneous())
qt_sendSpontaneousEvent(d->hbar, &hwe);
else
- QApplication::sendEvent(d->hbar, &hwe);
+ QCoreApplication::sendEvent(d->hbar, &hwe);
e->setAccepted(hwe.isAccepted());
} else {
- QApplication::sendEvent(d->vbar, e);
+ QCoreApplication::sendEvent(d->vbar, e);
}
} else {
- QApplication::sendEvent(d->hbar, e);
+ QCoreApplication::sendEvent(d->hbar, e);
}
}
#endif // QT_CONFIG(wheelevent)
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index f6631199d6..47e91bf8f9 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -47,15 +47,15 @@
#include "qlist.h"
#include "qstylehints.h"
#include <private/qshortcutmap_p.h>
-#include <private/qapplication_p.h>
+#include <private/qguiapplication_p.h>
#if QT_CONFIG(menu)
#include <private/qmenu_p.h>
#endif
#include <private/qdebug_p.h>
#define QAPP_CHECK(functionName) \
- if (Q_UNLIKELY(!qApp)) { \
- qWarning("QAction: Initialize QApplication before calling '" functionName "'."); \
+ if (Q_UNLIKELY(!QCoreApplication::instance())) { \
+ qWarning("QAction: Initialize Q(Gui)Application before calling '" functionName "'."); \
return; \
}
@@ -101,7 +101,7 @@ bool QActionPrivate::showStatusText(QWidget *widget, const QString &str)
#else
if(QObject *object = widget ? widget : parent) {
QStatusTipEvent tip(str);
- QApplication::sendEvent(object, &tip);
+ QCoreApplication::sendEvent(object, &tip);
return true;
}
#endif
@@ -114,15 +114,15 @@ void QActionPrivate::sendDataChanged()
QActionEvent e(QEvent::ActionChanged, q);
for (int i = 0; i < widgets.size(); ++i) {
QWidget *w = widgets.at(i);
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
}
#if QT_CONFIG(graphicsview)
for (int i = 0; i < graphicsWidgets.size(); ++i) {
QGraphicsWidget *w = graphicsWidgets.at(i);
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
}
#endif
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
emit q->changed();
}
@@ -391,7 +391,7 @@ void QAction::setShortcut(const QKeySequence &shortcut)
return;
d->shortcut = shortcut;
- d->redoGrab(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
@@ -420,8 +420,8 @@ void QAction::setShortcuts(const QList<QKeySequence> &shortcuts)
d->shortcut = primary;
d->alternateShortcuts = listCopy;
- d->redoGrab(qApp->d_func()->shortcutMap);
- d->redoGrabAlternate(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+ d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
@@ -485,8 +485,8 @@ void QAction::setShortcutContext(Qt::ShortcutContext context)
return;
QAPP_CHECK("setShortcutContext");
d->shortcutContext = context;
- d->redoGrab(qApp->d_func()->shortcutMap);
- d->redoGrabAlternate(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+ d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
@@ -513,8 +513,8 @@ void QAction::setAutoRepeat(bool on)
return;
QAPP_CHECK("setAutoRepeat");
d->autorepeat = on;
- d->redoGrab(qApp->d_func()->shortcutMap);
- d->redoGrabAlternate(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+ d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
@@ -575,10 +575,10 @@ QAction::~QAction()
d->group->removeAction(this);
#ifndef QT_NO_SHORTCUT
if (d->shortcutId && qApp) {
- qApp->d_func()->shortcutMap.removeShortcut(d->shortcutId, this);
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->shortcutId, this);
for(int i = 0; i < d->alternateShortcutIds.count(); ++i) {
const int id = d->alternateShortcutIds.at(i);
- qApp->d_func()->shortcutMap.removeShortcut(id, this);
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
}
}
#endif
@@ -1028,7 +1028,7 @@ void QAction::setEnabled(bool b)
QAPP_CHECK("setEnabled");
d->enabled = b;
#ifndef QT_NO_SHORTCUT
- d->setShortcutEnabled(b, qApp->d_func()->shortcutMap);
+ d->setShortcutEnabled(b, QGuiApplicationPrivate::instance()->shortcutMap);
#endif
d->sendDataChanged();
}
@@ -1061,8 +1061,8 @@ void QAction::setVisible(bool b)
d->forceInvisible = !b;
d->visible = b;
d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ;
-#ifndef QT_NO_SHORTCUT
- d->setShortcutEnabled(d->enabled, qApp->d_func()->shortcutMap);
+#if QT_CONFIG(shortcut)
+ d->setShortcutEnabled(d->enabled, QGuiApplicationPrivate::instance()->shortcutMap);
#endif
d->sendDataChanged();
}
@@ -1285,7 +1285,7 @@ void QAction::setIconVisibleInMenu(bool visible)
d->iconVisibleInMenu = visible;
// Only send data changed if we really need to.
if (oldValue != -1
- || visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus)) {
+ || visible == !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus)) {
d->sendDataChanged();
}
}
@@ -1295,7 +1295,7 @@ bool QAction::isIconVisibleInMenu() const
{
Q_D(const QAction);
if (d->iconVisibleInMenu == -1) {
- return !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus);
+ return !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
}
return d->iconVisibleInMenu;
}
@@ -1323,7 +1323,7 @@ void QAction::setShortcutVisibleInContextMenu(bool visible)
d->shortcutVisibleInContextMenu = visible;
// Only send data changed if we really need to.
if (oldValue != -1
- || visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowShortcutsInContextMenus)) {
+ || visible == !QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus)) {
d->sendDataChanged();
}
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 526bf0a0ff..22ebeaae51 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -622,7 +622,7 @@ void QApplicationPrivate::initialize()
if (qt_is_gui_used)
initializeMultitouch();
- if (QApplication::desktopSettingsAware())
+ if (QGuiApplication::desktopSettingsAware())
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
}
@@ -1172,7 +1172,7 @@ void QApplication::setStyle(QStyle *style)
QWidget *w = *it;
if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) {
QEvent e(QEvent::StyleChange);
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
w->update();
}
}
@@ -1189,7 +1189,7 @@ void QApplication::setStyle(QStyle *style)
if (QApplicationPrivate::focus_widget) {
QFocusEvent in(QEvent::FocusIn, Qt::OtherFocusReason);
- QApplication::sendEvent(QApplicationPrivate::focus_widget->style(), &in);
+ QCoreApplication::sendEvent(QApplicationPrivate::focus_widget->style(), &in);
QApplicationPrivate::focus_widget->update();
}
}
@@ -1551,7 +1551,7 @@ void QApplication::setFont(const QFont &font, const char *className)
if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
// Send ApplicationFontChange to qApp itself, and to the widgets.
QEvent e(QEvent::ApplicationFontChange);
- QApplication::sendEvent(QApplication::instance(), &e);
+ QCoreApplication::sendEvent(QApplication::instance(), &e);
QWidgetList wids = QApplication::allWidgets();
for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) {
@@ -1565,7 +1565,7 @@ void QApplication::setFont(const QFont &font, const char *className)
QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list;
for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin();
it != scenes.constEnd(); ++it) {
- QApplication::sendEvent(*it, &e);
+ QCoreApplication::sendEvent(*it, &e);
}
#endif // QT_CONFIG(graphicsview)
}
@@ -1739,16 +1739,16 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
#endif
QFocusEvent out(QEvent::FocusOut, reason);
QPointer<QWidget> that = prev;
- QApplication::sendEvent(prev, &out);
+ QCoreApplication::sendEvent(prev, &out);
if (that)
- QApplication::sendEvent(that->style(), &out);
+ QCoreApplication::sendEvent(that->style(), &out);
}
if(focus && QApplicationPrivate::focus_widget == focus) {
QFocusEvent in(QEvent::FocusIn, reason);
QPointer<QWidget> that = focus;
- QApplication::sendEvent(focus, &in);
+ QCoreApplication::sendEvent(focus, &in);
if (that)
- QApplication::sendEvent(that->style(), &in);
+ QCoreApplication::sendEvent(that->style(), &in);
}
emit qApp->focusChanged(prev, focus_widget);
}
@@ -1924,7 +1924,7 @@ bool QApplication::event(QEvent *e)
}
if (showToolTip) {
QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos);
- QApplication::sendEvent(d->toolTipWidget, &e);
+ 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);
@@ -2036,7 +2036,7 @@ void QApplication::setActiveWindow(QWidget* act)
QGuiApplication::inputMethod()->commit();
QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason);
- QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange);
+ QCoreApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange);
}
QApplicationPrivate::active_window = window;
@@ -2111,7 +2111,7 @@ QWidget *qt_tlw_for_window(QWindow *wnd)
wnd = wnd->parent();
}
if (wnd) {
- const auto tlws = qApp->topLevelWidgets();
+ const auto tlws = QApplication::topLevelWidgets();
for (QWidget *tlw : tlws) {
if (tlw->windowHandle() == wnd)
return tlw;
@@ -2205,12 +2205,12 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
#if 0
if (leave) {
QEvent e(QEvent::Leave);
- QApplication::sendEvent(leave, & e);
+ QCoreApplication::sendEvent(leave, & e);
}
if (enter) {
const QPoint windowPos = enter->window()->mapFromGlobal(globalPos);
QEnterEvent e(enter->mapFromGlobal(globalPos), windowPos, globalPos);
- QApplication::sendEvent(enter, & e);
+ QCoreApplication::sendEvent(enter, & e);
}
return;
#endif
@@ -2271,12 +2271,12 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
for (int i = 0; i < leaveList.size(); ++i) {
auto *w = leaveList.at(i);
if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
- QApplication::sendEvent(w, &leaveEvent);
+ QCoreApplication::sendEvent(w, &leaveEvent);
if (w->testAttribute(Qt::WA_Hover) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
Q_ASSERT(instance());
QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos),
- QApplication::keyboardModifiers());
+ QGuiApplication::keyboardModifiers());
qApp->d_func()->notify_helper(w, &he);
}
}
@@ -2292,11 +2292,11 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
const QPointF localPos = w->mapFromGlobal(globalPos);
QEnterEvent enterEvent(localPos, windowPos, globalPosF);
- QApplication::sendEvent(w, &enterEvent);
+ QCoreApplication::sendEvent(w, &enterEvent);
if (w->testAttribute(Qt::WA_Hover) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
QHoverEvent he(QEvent::HoverEnter, localPos, QPoint(-1, -1),
- QApplication::keyboardModifiers());
+ QGuiApplication::keyboardModifiers());
qApp->d_func()->notify_helper(w, &he);
}
}
@@ -2644,7 +2644,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
if (spontaneous)
result = QApplication::sendSpontaneousEvent(receiver, event);
else
- result = QApplication::sendEvent(receiver, event);
+ result = QCoreApplication::sendEvent(receiver, event);
}
if (!graphicsWidget && leaveAfterRelease && event->type() == QEvent::MouseButtonRelease
@@ -2898,7 +2898,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
#ifndef QT_NO_DEBUG
- d->checkReceiverThread(receiver);
+ QCoreApplicationPrivate::checkReceiverThread(receiver);
#endif
if (receiver->isWindowType()) {
@@ -3818,7 +3818,7 @@ void QApplicationPrivate::openPopup(QWidget *popup)
} else if (popupWidgets->count() == 1) { // this was the first popup
if (QWidget *fw = QApplication::focusWidget()) {
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
- QApplication::sendEvent(fw, &e);
+ QCoreApplication::sendEvent(fw, &e);
}
}
}
@@ -4383,7 +4383,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QTouchEvent touchEvent(eventType,
device,
- QApplication::keyboardModifiers(),
+ QGuiApplication::keyboardModifiers(),
it.value().first,
it.value().second);
bool containsPress = updateTouchPointsForWidget(widget, &touchEvent);
@@ -4426,7 +4426,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong timestamp)
{
- QTouchEvent touchEvent(QEvent::TouchCancel, device, QApplication::keyboardModifiers());
+ QTouchEvent touchEvent(QEvent::TouchCancel, device, QGuiApplication::keyboardModifiers());
touchEvent.setTimestamp(timestamp);
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it
= self->activeTouchPoints.constBegin(), ite = self->activeTouchPoints.constEnd();
@@ -4462,12 +4462,12 @@ void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const
const QWidgetList widgets = QApplication::allWidgets();
for (auto widget : widgets) {
if (toAllWidgets || (!className && widget->isWindow()) || (className && widget->inherits(className)))
- QApplication::sendEvent(widget, &event);
+ QCoreApplication::sendEvent(widget, &event);
}
#if QT_CONFIG(graphicsview)
for (auto scene : qAsConst(scene_list))
- QApplication::sendEvent(scene, &event);
+ QCoreApplication::sendEvent(scene, &event);
#endif // QT_CONFIG(graphicsview)
}
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index a368f379ad..76d8533271 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -172,7 +172,7 @@ void QBoxLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *b
rightDelta = w->geometry().right() - itm->geometry().right();
}
QWidget *w = q->parentWidget();
- Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : QApplication::layoutDirection();
+ Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : QGuiApplication::layoutDirection();
if (layoutDirection == Qt::RightToLeft)
qSwap(leftDelta, rightDelta);
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 9146ba84c8..6f7527c013 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -2178,7 +2178,7 @@ void QFormLayoutPrivate::arrangeWidgets(const QVector<QLayoutStruct>& layouts, Q
int i;
const int rr = m_matrix.rowCount();
QWidget *w = q->parentWidget();
- Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : QApplication::layoutDirection();
+ Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : QGuiApplication::layoutDirection();
Qt::Alignment formAlignment = fixedAlignment(q->formAlignment(), layoutDirection);
int leftOffset = 0;
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index ff7bc1eccf..1555c2a73a 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -707,7 +707,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
foreach(QGesture *g, gestures)
event.setAccepted(g, false);
- QApplication::sendEvent(receiver, &event);
+ QCoreApplication::sendEvent(receiver, &event);
bool eventAccepted = event.isAccepted();
const auto eventGestures = event.gestures();
for (QGesture *gesture : eventGestures) {
@@ -734,7 +734,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending to" << it.key()
<< "gestures:" << it.value();
QGestureEvent event(it.value());
- QApplication::sendEvent(it.key(), &event);
+ QCoreApplication::sendEvent(it.key(), &event);
bool eventAccepted = event.isAccepted();
const auto eventGestures = event.gestures();
for (QGesture *gesture : eventGestures) {
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index f71d038a5f..3ce81a390b 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1040,7 +1040,7 @@ void QLayout::update()
if (layout->d_func()->topLevel) {
Q_ASSERT(layout->parent()->isWidgetType());
QWidget *mw = static_cast<QWidget*>(layout->parent());
- QApplication::postEvent(mw, new QEvent(QEvent::LayoutRequest));
+ QCoreApplication::postEvent(mw, new QEvent(QEvent::LayoutRequest));
break;
}
layout = static_cast<QLayout*>(layout->parent());
@@ -1366,7 +1366,7 @@ QRect QLayout::alignmentRect(const QRect &r) const
y += (r.height() - s.height()) / 2;
QWidget *parent = parentWidget();
- a = QStyle::visualAlignment(parent ? parent->layoutDirection() : QApplication::layoutDirection(), a);
+ a = QStyle::visualAlignment(parent ? parent->layoutDirection() : QGuiApplication::layoutDirection(), a);
if (a & Qt::AlignRight)
x += (r.width() - s.width());
else if (!(a & Qt::AlignLeft))
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index ae7729b49b..451b18d8d3 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -1432,7 +1432,7 @@ bool QOpenGLWidget::event(QEvent *e)
Q_D(QOpenGLWidget);
switch (e->type()) {
case QEvent::WindowChangeInternal:
- if (qGuiApp->testAttribute(Qt::AA_ShareOpenGLContexts))
+ if (QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
break;
if (d->initialized)
d->reset();
@@ -1445,7 +1445,7 @@ bool QOpenGLWidget::event(QEvent *e)
{
// Special case: did grabFramebuffer() for a hidden widget that then became visible.
// Recreate all resources since the context now needs to share with the TLW's.
- if (!qGuiApp->testAttribute(Qt::AA_ShareOpenGLContexts))
+ if (!QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
d->reset();
}
if (!d->initialized && !size().isEmpty() && window()->windowHandle()) {
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index a680ff7913..c7b9f3ec7a 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -228,7 +228,7 @@ static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsW
{
bool visible = w->isVisible();
#if defined(Q_OS_DARWIN) && QT_CONFIG(menubar)
- if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
+ if (!QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true;
#endif
@@ -488,7 +488,7 @@ QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
Q_D(QShortcut);
d->sc_context = context;
d->sc_sequence = key;
- d->redoGrab(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
if (member)
connect(this, SIGNAL(activated()), parent, member);
if (ambiguousMember)
@@ -502,7 +502,7 @@ QShortcut::~QShortcut()
{
Q_D(QShortcut);
if (qApp)
- qApp->d_func()->shortcutMap.removeShortcut(d->sc_id, this);
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->sc_id, this);
}
/*!
@@ -523,7 +523,7 @@ void QShortcut::setKey(const QKeySequence &key)
return;
QAPP_CHECK("setKey");
d->sc_sequence = key;
- d->redoGrab(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
}
QKeySequence QShortcut::key() const
@@ -554,7 +554,7 @@ void QShortcut::setEnabled(bool enable)
return;
QAPP_CHECK("setEnabled");
d->sc_enabled = enable;
- qApp->d_func()->shortcutMap.setShortcutEnabled(enable, d->sc_id, this);
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enable, d->sc_id, this);
}
bool QShortcut::isEnabled() const
@@ -582,7 +582,7 @@ void QShortcut::setContext(Qt::ShortcutContext context)
return;
QAPP_CHECK("setContext");
d->sc_context = context;
- d->redoGrab(qApp->d_func()->shortcutMap);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
}
Qt::ShortcutContext QShortcut::context() const
@@ -634,7 +634,7 @@ void QShortcut::setAutoRepeat(bool on)
return;
QAPP_CHECK("setAutoRepeat");
d->sc_autorepeat = on;
- qApp->d_func()->shortcutMap.setShortcutAutoRepeat(on, d->sc_id, this);
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(on, d->sc_id, this);
}
bool QShortcut::autoRepeat() const
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 4a798a7490..a48eae6628 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -263,7 +263,7 @@ void QWhatsThat::mouseReleaseEvent(QMouseEvent* e)
anchor.clear();
if (!href.isEmpty()) {
QWhatsThisClickedEvent e(href);
- if (QApplication::sendEvent(widget, &e))
+ if (QCoreApplication::sendEvent(widget, &e))
return;
}
}
@@ -380,7 +380,7 @@ void QWhatsThisPrivate::notifyToplevels(QEvent *e)
{
const QWidgetList toplevels = QApplication::topLevelWidgets();
for (auto *w : toplevels)
- QApplication::sendEvent(w, e);
+ QCoreApplication::sendEvent(w, e);
}
QWhatsThisPrivate *QWhatsThisPrivate::instance = 0;
@@ -394,7 +394,7 @@ QWhatsThisPrivate::QWhatsThisPrivate()
QPoint pos = QCursor::pos();
if (QWidget *w = QApplication::widgetAt(pos)) {
QHelpEvent e(QEvent::QueryWhatsThis, w->mapFromGlobal(pos), pos);
- bool sentEvent = QApplication::sendEvent(w, &e);
+ const bool sentEvent = QCoreApplication::sendEvent(w, &e);
#ifdef QT_NO_CURSOR
Q_UNUSED(sentEvent);
#else
@@ -439,7 +439,7 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
if (me->button() == Qt::RightButton || customWhatsThis)
return false;
QHelpEvent e(QEvent::WhatsThis, me->pos(), me->globalPos());
- if (!QApplication::sendEvent(w, &e) || !e.isAccepted())
+ if (!QCoreApplication::sendEvent(w, &e) || !e.isAccepted())
leaveOnMouseRelease = true;
} break;
@@ -448,12 +448,12 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
{
QMouseEvent *me = static_cast<QMouseEvent*>(e);
QHelpEvent e(QEvent::QueryWhatsThis, me->pos(), me->globalPos());
- bool sentEvent = QApplication::sendEvent(w, &e);
+ const bool sentEvent = QCoreApplication::sendEvent(w, &e);
#ifdef QT_NO_CURSOR
Q_UNUSED(sentEvent);
#else
- QApplication::changeOverrideCursor((!sentEvent || !e.isAccepted())?
- Qt::ForbiddenCursor:Qt::WhatsThisCursor);
+ QGuiApplication::changeOverrideCursor((!sentEvent || !e.isAccepted())?
+ Qt::ForbiddenCursor:Qt::WhatsThisCursor);
#endif
Q_FALLTHROUGH();
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 2176c612d0..f686341f6e 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -359,7 +359,7 @@ void QWidgetPrivate::scrollChildren(int dx, int dy)
w->d_func()->setWSGeometry();
w->d_func()->setDirtyOpaqueRegion();
QMoveEvent e(r.topLeft(), oldp);
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
}
}
}
@@ -435,13 +435,13 @@ void QWidget::setEditFocus(bool on)
if (!on && QWidgetPrivate::editingWidget == f) {
QWidgetPrivate::editingWidget = 0;
QEvent event(QEvent::LeaveEditFocus);
- QApplication::sendEvent(f, &event);
- QApplication::sendEvent(f->style(), &event);
+ QCoreApplication::sendEvent(f, &event);
+ QCoreApplication::sendEvent(f->style(), &event);
} else if (on) {
QWidgetPrivate::editingWidget = f;
QEvent event(QEvent::EnterEditFocus);
- QApplication::sendEvent(f, &event);
- QApplication::sendEvent(f->style(), &event);
+ QCoreApplication::sendEvent(f, &event);
+ QCoreApplication::sendEvent(f->style(), &event);
}
}
#endif
@@ -1223,8 +1223,8 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
q->create();
QEvent e(QEvent::Create);
- QApplication::sendEvent(q, &e);
- QApplication::postEvent(q, new QEvent(QEvent::PolishRequest));
+ QCoreApplication::sendEvent(q, &e);
+ QCoreApplication::postEvent(q, new QEvent(QEvent::PolishRequest));
extraPaintEngine = 0;
@@ -1624,7 +1624,7 @@ QWidget::~QWidget()
// Remove all shortcuts grabbed by this
// widget, unless application is closing
if (!QApplicationPrivate::is_app_closing && testAttribute(Qt::WA_GrabbedShortcut))
- qApp->d_func()->shortcutMap.removeShortcut(0, this, QKeySequence());
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, QKeySequence());
#endif
// delete layout while we still are a valid widget
@@ -1732,7 +1732,7 @@ QWidget::~QWidget()
if (!d->children.isEmpty())
d->deleteChildren();
- QApplication::removePostedEvents(this);
+ QCoreApplication::removePostedEvents(this);
QT_TRY {
destroy(); // platform-dependent cleanup
@@ -2044,7 +2044,7 @@ void QWidgetPrivate::propagatePaletteChange()
QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);
QEvent pc(QEvent::PaletteChange);
- QApplication::sendEvent(q, &pc);
+ QCoreApplication::sendEvent(q, &pc);
for (int i = 0; i < children.size(); ++i) {
QWidget *w = qobject_cast<QWidget*>(children.at(i));
if (w && (!w->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles)
@@ -2848,7 +2848,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate)
#endif
QEvent e(QEvent::StyleChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
#ifndef QT_NO_STYLE_STYLESHEET
// dereference the old stylesheet style
@@ -3066,7 +3066,7 @@ void QWidget::overrideWindowState(Qt::WindowStates newstate)
{
QWindowStateChangeEvent e(Qt::WindowStates(data->window_state), true);
data->window_state = newstate;
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
/*!
@@ -3128,7 +3128,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
activateWindow();
QWindowStateChangeEvent e(oldstate);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
/*!
@@ -3354,7 +3354,7 @@ void QWidget::insertAction(QAction *before, QAction *action)
apriv->widgets.append(this);
QActionEvent e(QEvent::ActionAdded, action, before);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
/*!
@@ -3392,7 +3392,7 @@ void QWidget::removeAction(QAction *action)
if (d->actions.removeAll(action)) {
QActionEvent e(QEvent::ActionRemoved, action);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
}
@@ -3499,7 +3499,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
}
#endif //QT_NO_IM
QEvent e(QEvent::EnabledChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
/*!
@@ -4566,7 +4566,7 @@ void QWidget::setForegroundRole(QPalette::ColorRole role)
the "color", "background-color", "selection-color",
"selection-background-color" and "alternate-background-color".
- \sa QApplication::palette(), QWidget::font(), {Qt Style Sheets}
+ \sa QGuiApplication::palette(), QWidget::font(), {Qt Style Sheets}
*/
const QPalette &QWidget::palette() const
{
@@ -4629,7 +4629,7 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const
)) {
if (QWidget *p = q->parentWidget()) {
if (!p->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
- if (!naturalPalette.isCopyOf(QApplication::palette())) {
+ if (!naturalPalette.isCopyOf(QGuiApplication::palette())) {
QPalette inheritedPalette = p->palette();
inheritedPalette.resolve(inheritedMask);
naturalPalette = inheritedPalette.resolve(naturalPalette);
@@ -4895,7 +4895,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
#endif
QEvent e(QEvent::FontChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
void QWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction)
@@ -4913,14 +4913,14 @@ void QWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction)
}
}
QEvent e(QEvent::LayoutDirectionChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
void QWidgetPrivate::resolveLayoutDirection()
{
Q_Q(const QWidget);
if (!q->testAttribute(Qt::WA_SetLayoutDirection))
- setLayoutDirection_helper(q->isWindow() ? QApplication::layoutDirection() : q->parentWidget()->layoutDirection());
+ setLayoutDirection_helper(q->isWindow() ? QGuiApplication::layoutDirection() : q->parentWidget()->layoutDirection());
}
/*!
@@ -5040,7 +5040,7 @@ void QWidget::setCursor(const QCursor &cursor)
d->setCursor_sys(cursor);
QEvent event(QEvent::CursorChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
void QWidgetPrivate::setCursor_sys(const QCursor &cursor)
@@ -5062,7 +5062,7 @@ void QWidget::unsetCursor()
d->unsetCursor_sys();
QEvent event(QEvent::CursorChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
void QWidgetPrivate::unsetCursor_sys()
@@ -5260,7 +5260,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
static void sendResizeEvents(QWidget *target)
{
QResizeEvent e(target->size(), QSize());
- QApplication::sendEvent(target, &e);
+ QCoreApplication::sendEvent(target, &e);
const QObjectList children = target->children();
for (int i = 0; i < children.size(); ++i) {
@@ -6014,7 +6014,7 @@ void QWidgetPrivate::setLocale_helper(const QLocale &loc, bool forceUpdate)
}
}
QEvent e(QEvent::LocaleChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
void QWidget::setLocale(const QLocale &locale)
@@ -6189,7 +6189,7 @@ void QWidget::setWindowIconText(const QString &iconText)
d->setWindowIconText_helper(iconText);
QEvent e(QEvent::IconTextChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
emit windowIconTextChanged(iconText);
}
@@ -6213,7 +6213,7 @@ void QWidget::setWindowTitle(const QString &title)
d->setWindowTitle_helper(title);
QEvent e(QEvent::WindowTitleChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
emit windowTitleChanged(title);
}
@@ -6251,11 +6251,11 @@ void QWidgetPrivate::setWindowIcon_helper()
// QWidgetWindow to the top level QWidget ensures that the event reaches
// the top level anyhow
if (!q->windowHandle())
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
for (int i = 0; i < children.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(children.at(i));
if (w && !w->isWindow())
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
}
}
@@ -6598,7 +6598,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
if (reason != Qt::NoFocusReason) {
QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason);
- QApplication::sendEvent(prev, &focusAboutToChange);
+ QCoreApplication::sendEvent(prev, &focusAboutToChange);
}
}
@@ -6625,9 +6625,9 @@ void QWidget::setFocus(Qt::FocusReason reason)
// Send event to self
QFocusEvent event(QEvent::FocusOut, reason);
QPointer<QWidget> that = previousProxyFocus;
- QApplication::sendEvent(previousProxyFocus, &event);
+ QCoreApplication::sendEvent(previousProxyFocus, &event);
if (that)
- QApplication::sendEvent(that->style(), &event);
+ QCoreApplication::sendEvent(that->style(), &event);
}
if (!isHidden()) {
#if QT_CONFIG(graphicsview)
@@ -6639,9 +6639,9 @@ void QWidget::setFocus(Qt::FocusReason reason)
// Send event to self
QFocusEvent event(QEvent::FocusIn, reason);
QPointer<QWidget> that = f;
- QApplication::sendEvent(f, &event);
+ QCoreApplication::sendEvent(f, &event);
if (that)
- QApplication::sendEvent(that->style(), &event);
+ QCoreApplication::sendEvent(that->style(), &event);
}
}
}
@@ -6748,7 +6748,7 @@ void QWidget::clearFocus()
QGuiApplication::inputMethod()->commit();
QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
- QApplication::sendEvent(this, &focusAboutToChange);
+ QCoreApplication::sendEvent(this, &focusAboutToChange);
}
QWidget *w = this;
@@ -7395,11 +7395,11 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (isMove) {
QMoveEvent e(q->pos(), oldPos);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
if (isResize) {
QResizeEvent e(r.size(), olds);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
if (q->windowHandle())
q->update();
}
@@ -7697,13 +7697,13 @@ void QWidgetPrivate::updateContentsRect()
if (q->isVisible()) {
q->update();
QResizeEvent e(q->data->crect.size(), q->data->crect.size());
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
} else {
q->setAttribute(Qt::WA_PendingResizeEvent, true);
}
QEvent e(QEvent::ContentsRectChange);
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
}
/*!
@@ -7999,13 +7999,13 @@ void QWidgetPrivate::sendPendingMoveAndResizeEvents(bool recursive, bool disable
if (q->testAttribute(Qt::WA_PendingMoveEvent)) {
QMoveEvent e(data.crect.topLeft(), data.crect.topLeft());
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
q->setAttribute(Qt::WA_PendingMoveEvent, false);
}
if (q->testAttribute(Qt::WA_PendingResizeEvent)) {
QResizeEvent e(data.crect.size(), QSize());
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
q->setAttribute(Qt::WA_PendingResizeEvent, false);
}
@@ -8115,7 +8115,7 @@ void QWidgetPrivate::show_helper()
// send the show event before showing the window
QShowEvent showEvent;
- QApplication::sendEvent(q, &showEvent);
+ QCoreApplication::sendEvent(q, &showEvent);
show_sys();
@@ -8138,7 +8138,7 @@ void QWidgetPrivate::show_helper()
// is spinnning; otherwise it might not show up on particular platforms.
// This makes QSplashScreen behave the same on all platforms.
if (!qApp->d_func()->in_exec && q->windowType() == Qt::SplashScreen)
- QApplication::processEvents();
+ QCoreApplication::processEvents();
data.in_show = false; // reset qws optimization
}
@@ -8164,9 +8164,9 @@ void QWidgetPrivate::show_sys()
}
if (renderToTexture && !q->isWindow())
- QApplication::postEvent(q->parentWidget(), new QUpdateLaterEvent(q->geometry()));
+ QCoreApplication::postEvent(q->parentWidget(), new QUpdateLaterEvent(q->geometry()));
else
- QApplication::postEvent(q, new QUpdateLaterEvent(q->rect()));
+ QCoreApplication::postEvent(q, new QUpdateLaterEvent(q->rect()));
if ((!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow))
|| q->testAttribute(Qt::WA_OutsideWSRange)) {
@@ -8254,7 +8254,7 @@ void QWidgetPrivate::hide_helper()
}
QHideEvent hideEvent;
- QApplication::sendEvent(q, &hideEvent);
+ QCoreApplication::sendEvent(q, &hideEvent);
hideChildren(false);
// next bit tries to move the focus if the focus widget is now
@@ -8425,7 +8425,7 @@ void QWidgetPrivate::setVisible(bool visible)
}
QEvent showToParentEvent(QEvent::ShowToParent);
- QApplication::sendEvent(q, &showToParentEvent);
+ QCoreApplication::sendEvent(q, &showToParentEvent);
} else { // hide
#if 0 // Used to be included in Qt4 for Q_WS_WIN
// reset WS_DISABLED style in a Blocked window
@@ -8456,11 +8456,11 @@ void QWidgetPrivate::setVisible(bool visible)
if (q->parentWidget()->d_func()->layout)
q->parentWidget()->d_func()->layout->invalidate();
else if (q->parentWidget()->isVisible())
- QApplication::postEvent(q->parentWidget(), new QEvent(QEvent::LayoutRequest));
+ QCoreApplication::postEvent(q->parentWidget(), new QEvent(QEvent::LayoutRequest));
}
QEvent hideToParentEvent(QEvent::HideToParent);
- QApplication::sendEvent(q, &hideToParentEvent);
+ QCoreApplication::sendEvent(q, &hideToParentEvent);
}
}
@@ -8535,7 +8535,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
if (spontaneous) {
QApplication::sendSpontaneousEvent(widget, &e);
} else {
- QApplication::sendEvent(widget, &e);
+ QCoreApplication::sendEvent(widget, &e);
if (widget->internalWinId()
&& widget->testAttribute(Qt::WA_DontCreateNativeAncestors)) {
// hide_sys() on an ancestor won't have any affect on this
@@ -8570,7 +8570,7 @@ bool QWidgetPrivate::close_helper(CloseMode mode)
if (mode == CloseWithSpontaneousEvent)
QApplication::sendSpontaneousEvent(q, &e);
else
- QApplication::sendEvent(q, &e);
+ QCoreApplication::sendEvent(q, &e);
if (!that.isNull() && !e.isAccepted()) {
data.is_closing = 0;
return false;
@@ -9085,7 +9085,7 @@ bool QWidget::event(QEvent *event)
setAttribute(Qt::WA_WState_Polished);
if (!QApplication::font(this).isCopyOf(QApplication::font()))
d->resolveFont();
- if (!QApplication::palette(this).isCopyOf(QApplication::palette()))
+ if (!QApplication::palette(this).isCopyOf(QGuiApplication::palette()))
d->resolvePalette();
}
break;
@@ -9109,7 +9109,7 @@ bool QWidget::event(QEvent *event)
#if QT_CONFIG(statustip)
if (d->statusTip.size()) {
QStatusTipEvent tip(d->statusTip);
- QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
+ QCoreApplication::sendEvent(const_cast<QWidget *>(this), &tip);
}
#endif
enterEvent(event);
@@ -9120,7 +9120,7 @@ bool QWidget::event(QEvent *event)
if (d->statusTip.size()) {
QString empty;
QStatusTipEvent tip(empty);
- QApplication::sendEvent(const_cast<QWidget *>(this), &tip);
+ QCoreApplication::sendEvent(const_cast<QWidget *>(this), &tip);
}
#endif
leaveEvent(event);
@@ -9271,7 +9271,7 @@ bool QWidget::event(QEvent *event)
for (int i = 0; i < childList.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(childList.at(i));
if (w && w->isVisible() && !w->isWindow())
- QApplication::sendEvent(w, event);
+ QCoreApplication::sendEvent(w, event);
}
break; }
@@ -9282,7 +9282,7 @@ bool QWidget::event(QEvent *event)
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
if (o)
- QApplication::sendEvent(o, event);
+ QCoreApplication::sendEvent(o, event);
}
}
update();
@@ -9321,7 +9321,7 @@ bool QWidget::event(QEvent *event)
QWidget *w = static_cast<QWidget *>(o);
// do not forward the event to child windows; QApplication does this for us
if (!w->isWindow())
- QApplication::sendEvent(w, event);
+ QCoreApplication::sendEvent(w, event);
}
}
}
@@ -9373,7 +9373,7 @@ bool QWidget::event(QEvent *event)
for (int i = 0; i < childList.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(childList.at(i));
if (w && w->isVisible() && !w->isWindow())
- QApplication::sendEvent(w, event);
+ QCoreApplication::sendEvent(w, event);
}
break;
}
@@ -9482,8 +9482,8 @@ void QWidget::changeEvent(QEvent * event)
break;
case QEvent::ThemeChange:
- if (QApplication::desktopSettingsAware() && windowType() != Qt::Desktop
- && qApp && !QApplication::closingDown()) {
+ if (QGuiApplication::desktopSettingsAware() && windowType() != Qt::Desktop
+ && qApp && !QCoreApplication::closingDown()) {
if (testAttribute(Qt::WA_WState_Polished))
QApplication::style()->unpolish(this);
if (testAttribute(Qt::WA_WState_Polished))
@@ -10550,7 +10550,7 @@ void QWidgetPrivate::updateGeometry_helper(bool forceUpdate)
if (parent->d_func()->layout)
parent->d_func()->layout->invalidate();
else if (parent->isVisible())
- QApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));
+ QCoreApplication::postEvent(parent, new QEvent(QEvent::LayoutRequest));
}
}
}
@@ -10704,7 +10704,7 @@ static void sendWindowChangeToTextureChildrenRecursively(QWidget *widget)
QWidgetPrivate *d = QWidgetPrivate::get(widget);
if (d->renderToTexture) {
QEvent e(QEvent::WindowChangeInternal);
- QApplication::sendEvent(widget, &e);
+ QCoreApplication::sendEvent(widget, &e);
}
for (int i = 0; i < d->children.size(); ++i) {
@@ -10753,7 +10753,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
if (newParent && parent && !desktopWidget) {
- if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings))
+ if (testAttribute(Qt::WA_NativeWindow) && !QCoreApplication::testAttribute(Qt::AA_DontCreateNativeWidgetSiblings))
parent->d_func()->enforceNativeChildren();
else if (parent->d_func()->nativeChildrenForced() || parent->testAttribute(Qt::WA_PaintOnScreen))
setAttribute(Qt::WA_NativeWindow);
@@ -10766,7 +10766,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
}
if (newParent) {
QEvent e(QEvent::ParentAboutToChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
}
if (newParent && isAncestorOf(focusWidget()))
@@ -10839,7 +10839,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
// send and post remaining QObject events
if (parent && d->sendChildEvents) {
QChildEvent e(QEvent::ChildAdded, this);
- QApplication::sendEvent(parent, &e);
+ QCoreApplication::sendEvent(parent, &e);
}
//### already hidden above ---> must probably do something smart on the mac
@@ -10857,7 +10857,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
}
QEvent e(QEvent::ParentChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
#ifndef QT_NO_OPENGL
//renderToTexture widgets also need to know when their top-level window changes
@@ -11220,7 +11220,7 @@ void QWidgetPrivate::update(T r)
return;
if (q->testAttribute(Qt::WA_WState_InPaintEvent)) {
- QApplication::postEvent(q, new QUpdateLaterEvent(clipped));
+ QCoreApplication::postEvent(q, new QUpdateLaterEvent(clipped));
return;
}
@@ -11257,7 +11257,7 @@ void QWidgetPrivate::macUpdateSizeAttribute()
{
Q_Q(QWidget);
QEvent event(QEvent::MacSizeChange);
- QApplication::sendEvent(q, &event);
+ QCoreApplication::sendEvent(q, &event);
for (int i = 0; i < children.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(children.at(i));
if (w && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))
@@ -11313,7 +11313,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
else if (!on && (isWindow() || !parentWidget() || !parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
setAttribute(Qt::WA_DropSiteRegistered, false);
QEvent e(QEvent::AcceptDropsChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
break;
}
case Qt::WA_DropSiteRegistered: {
@@ -11396,11 +11396,11 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_MouseTracking: {
QEvent e(QEvent::MouseTrackingChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
break; }
case Qt::WA_TabletTracking: {
QEvent e(QEvent::TabletTrackingChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
break; }
case Qt::WA_NativeWindow: {
d->createTLExtra();
@@ -11413,7 +11413,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
QGuiApplication::inputMethod()->commit();
QGuiApplication::inputMethod()->update(Qt::ImEnabled);
}
- if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget())
+ if (!QCoreApplication::testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget())
parentWidget()->d_func()->enforceNativeChildren();
if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
d->createWinId();
@@ -11649,7 +11649,7 @@ void QWidget::setWindowModified(bool mod)
d->setWindowModified_helper();
QEvent e(QEvent::ModifiedChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
void QWidgetPrivate::setWindowModified_helper()
@@ -11695,7 +11695,7 @@ void QWidget::setToolTip(const QString &s)
d->toolTip = s;
QEvent event(QEvent::ToolTipChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
QString QWidget::toolTip() const
@@ -11872,7 +11872,7 @@ int QWidget::grabShortcut(const QKeySequence &key, Qt::ShortcutContext context)
if (key.isEmpty())
return 0;
setAttribute(Qt::WA_GrabbedShortcut);
- return qApp->d_func()->shortcutMap.addShortcut(this, key, context, qWidgetShortcutContextMatcher);
+ return QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, key, context, qWidgetShortcutContextMatcher);
}
/*!
@@ -11894,7 +11894,7 @@ void QWidget::releaseShortcut(int id)
{
Q_ASSERT(qApp);
if (id)
- qApp->d_func()->shortcutMap.removeShortcut(id, this, 0);
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this, 0);
}
/*!
@@ -11913,7 +11913,7 @@ void QWidget::setShortcutEnabled(int id, bool enable)
{
Q_ASSERT(qApp);
if (id)
- qApp->d_func()->shortcutMap.setShortcutEnabled(enable, id, this, 0);
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enable, id, this, 0);
}
/*!
@@ -11928,7 +11928,7 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable)
{
Q_ASSERT(qApp);
if (id)
- qApp->d_func()->shortcutMap.setShortcutAutoRepeat(enable, id, this, 0);
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(enable, id, this, 0);
}
#endif // QT_NO_SHORTCUT
@@ -11983,7 +11983,7 @@ void QWidget::raise()
QWindowContainer::parentWasRaised(this);
QEvent e(QEvent::ZOrderChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
void QWidgetPrivate::raise_sys()
@@ -12033,7 +12033,7 @@ void QWidget::lower()
QWindowContainer::parentWasLowered(this);
QEvent e(QEvent::ZOrderChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
void QWidgetPrivate::lower_sys()
@@ -12080,7 +12080,7 @@ void QWidget::stackUnder(QWidget* w)
d->stackUnder_sys(w);
QEvent e(QEvent::ZOrderChange);
- QApplication::sendEvent(this, &e);
+ QCoreApplication::sendEvent(this, &e);
}
void QWidgetPrivate::stackUnder_sys(QWidget*)
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 595beeaf47..ab33649b3e 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -491,11 +491,11 @@ void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, UpdateTime updateTi
switch (updateTime) {
case UpdateLater:
updateRequestSent = true;
- QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority);
+ QCoreApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority);
break;
case UpdateNow: {
QEvent event(QEvent::UpdateRequest);
- QApplication::sendEvent(widget, &event);
+ QCoreApplication::sendEvent(widget, &event);
break;
}
}
@@ -1507,7 +1507,7 @@ void QWidgetPrivate::invalidateBackingStore(const T &r)
if (r.isEmpty())
return;
- if (QApplication::closingDown())
+ if (QCoreApplication::closingDown())
return;
Q_Q(QWidget);
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index a5d9eee49d..ba10083829 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -155,7 +155,7 @@ QWidgetWindow::QWidgetWindow(QWidget *widget)
// Enable QOpenGLWidget/QQuickWidget children if the platform plugin supports it,
// and the application developer has not explicitly disabled it.
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)
- && !QApplication::testAttribute(Qt::AA_ForceRasterWidgets)) {
+ && !QCoreApplication::testAttribute(Qt::AA_ForceRasterWidgets)) {
setSurfaceType(QSurface::RasterGLSurface);
}
connect(widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
@@ -496,8 +496,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
static const QEvent::Type contextMenuTrigger =
QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?
QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
- if (qApp->d_func()->inPopupMode()) {
- QWidget *activePopupWidget = qApp->activePopupWidget();
+ if (QApplicationPrivate::inPopupMode()) {
+ QWidget *activePopupWidget = QApplication::activePopupWidget();
QPoint mapped = event->pos();
if (activePopupWidget != m_widget)
mapped = activePopupWidget->mapFromGlobal(event->globalPos());
@@ -577,7 +577,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
}
}
- if (qApp->activePopupWidget() != activePopupWidget
+ if (QApplication::activePopupWidget() != activePopupWidget
&& qt_replay_popup_mouse_event
&& QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ReplayMousePressOutsidePopup).toBool()) {
if (m_widget->windowType() != Qt::Popup)
@@ -680,7 +680,7 @@ void QWidgetWindow::handleTouchEvent(QTouchEvent *event)
if (event->type() == QEvent::TouchCancel) {
QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp());
event->accept();
- } else if (qApp->d_func()->inPopupMode()) {
+ } else if (QApplicationPrivate::inPopupMode()) {
// Ignore touch events for popups. This will cause QGuiApplication to synthesise mouse
// events instead, which QWidgetWindow::handleMouseEvent will forward correctly:
event->ignore();
@@ -744,7 +744,7 @@ void QWidgetWindow::updateMargins()
static void sendScreenChangeRecursively(QWidget *widget)
{
QEvent e(QEvent::ScreenChangeInternal);
- QApplication::sendEvent(widget, &e);
+ QCoreApplication::sendEvent(widget, &e);
QWidgetPrivate *d = QWidgetPrivate::get(widget);
for (int i = 0; i < d->children.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 4b289d2d33..fd8581edbb 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -223,7 +223,7 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt:
// Otherwise we may end up with BadMatch failures on X11.
if (embeddedWindow->surfaceType() == QSurface::RasterSurface
&& QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)
- && !QApplication::testAttribute(Qt::AA_ForceRasterWidgets))
+ && !QCoreApplication::testAttribute(Qt::AA_ForceRasterWidgets))
embeddedWindow->setSurfaceType(QSurface::RasterGLSurface);
d->window = embeddedWindow;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 9e701995a4..7b53f5272c 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1253,12 +1253,12 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
*iconRect = QRect(tr.left() + offsetX, tr.center().y() - tabIconSize.height() / 2,
tabIconSize.width(), tabIconSize.height());
if (!verticalTabs)
- *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
+ *iconRect = QStyle::visualRect(opt->direction, opt->rect, *iconRect);
tr.setLeft(tr.left() + tabIconSize.width() + 4);
}
if (!verticalTabs)
- tr = proxyStyle->visualRect(opt->direction, opt->rect, tr);
+ tr = QStyle::visualRect(opt->direction, opt->rect, tr);
*textRect = tr;
}
@@ -4835,7 +4835,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_MessageBoxIconSize:
#ifdef Q_OS_MAC
- if (QApplication::desktopSettingsAware()) {
+ if (QGuiApplication::desktopSettingsAware()) {
ret = 64; // No DPI scaling, it's handled elsewhere.
} else
#endif
@@ -5460,14 +5460,14 @@ static QIcon clearTextIcon(bool rtl)
QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
const QWidget *widget) const
{
- const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QGuiApplication::isRightToLeft());
#ifdef QT_NO_IMAGEFORMAT_PNG
Q_UNUSED(widget);
Q_UNUSED(sp);
#else
QPixmap pixmap;
- if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
+ if (QGuiApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (sp) {
case SP_DialogYesButton:
case SP_DialogOkButton:
@@ -5829,7 +5829,7 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
const QWidget *widget) const
{
QIcon icon;
- const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QGuiApplication::isRightToLeft());
#ifdef Q_OS_WIN
switch (standardIcon) {
@@ -5881,7 +5881,7 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
#endif
- if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
+ if (QGuiApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:
icon = QIcon::fromTheme(QLatin1String("user-home"));
@@ -6057,13 +6057,13 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
default:
break;
}
- } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty())
+ } // if (QGuiApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty())
if (!icon.isNull())
return icon;
#if defined(Q_OS_MAC)
- if (QApplication::desktopSettingsAware()) {
+ if (QGuiApplication::desktopSettingsAware()) {
switch (standardIcon) {
case SP_DirIcon: {
// A rather special case
@@ -6129,7 +6129,7 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
default:
break;
}
- } // if (QApplication::desktopSettingsAware())
+ } // if (QGuiApplication::desktopSettingsAware())
#endif // Q_OS_MAC
switch (standardIcon) {
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 2c1132da19..6cbed34c3a 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -560,7 +560,7 @@ QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pi
x += w - pixmapWidth;
else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter)
x += w/2 - pixmapWidth/2;
- else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft())
+ else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QGuiApplication::isRightToLeft())
x += w - pixmapWidth;
result = QRect(x, y, pixmapWidth, pixmapHeight);
return result;
@@ -624,7 +624,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
const QPixmap &pixmap) const
{
qreal scale = pixmap.devicePixelRatio();
- QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect);
+ QRect aligned = alignedRect(QGuiApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect);
QRect inter = aligned.intersected(rect);
painter->drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.x(), inter.y() - aligned.y(), inter.width() * scale, inter.height() *scale);
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 88031a9f1e..4faf98a0a3 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -151,7 +151,7 @@ QT_BEGIN_NAMESPACE
QStyleOption::QStyleOption(int version, int type)
: version(version), type(type), state(QStyle::State_None),
- direction(QApplication::layoutDirection()), fontMetrics(QFont()), styleObject(0)
+ direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), styleObject(0)
{
}
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index c1f498cd0c..ea653459d3 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -909,7 +909,7 @@ static QStyle::StandardPixmap subControlIcon(int pe)
QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject *object)
: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)
{
- QPalette palette = QApplication::palette(); // ###: ideally widget's palette
+ QPalette palette = QGuiApplication::palette(); // ###: ideally widget's palette
ValueExtractor v(declarations, palette);
features = v.extractStyleFeatures();
@@ -2734,7 +2734,7 @@ static void updateObjects(const QList<const QObject *>& objects)
for (const QObject *object : objects) {
if (auto widget = qobject_cast<QWidget*>(const_cast<QObject*>(object))) {
widget->style()->polish(widget);
- QApplication::sendEvent(widget, &event);
+ QCoreApplication::sendEvent(widget, &event);
}
}
}
@@ -6073,7 +6073,7 @@ void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const
w->d_func()->directFontResolveMask = font.resolve();
QEvent e(QEvent::FontChange);
- QApplication::sendEvent(w, &e);
+ QCoreApplication::sendEvent(w, &e);
}
}
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 3c0478b84e..1d5934e3f7 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -244,11 +244,12 @@ void QWindowsStyle::polish(QApplication *app)
if (!proxy()->styleHint(SH_UnderlineShortcut, 0) && app)
app->installEventFilter(this);
- d->activeCaptionColor = app->palette().highlight().color();
- d->activeGradientCaptionColor = app->palette().highlight() .color();
- d->inactiveCaptionColor = app->palette().dark().color();
- d->inactiveGradientCaptionColor = app->palette().dark().color();
- d->inactiveCaptionText = app->palette().window().color();
+ const auto &palette = QGuiApplication::palette();
+ d->activeGradientCaptionColor = palette.highlight().color();
+ d->activeCaptionColor = d->activeGradientCaptionColor;
+ d->inactiveGradientCaptionColor = palette.dark().color();
+ d->inactiveCaptionColor = d->inactiveGradientCaptionColor;
+ d->inactiveCaptionText = palette.window().color();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //fetch native title bar colors
if(app->desktopSettingsAware()){
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index e41f7e7573..04407cdb1d 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1504,7 +1504,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
case QEvent::InputMethod:
case QEvent::ShortcutOverride:
- QApplication::sendEvent(d->widget, e);
+ QCoreApplication::sendEvent(d->widget, e);
break;
default:
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index a8b2a00a80..55ec93c7d3 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -228,7 +228,7 @@ public:
// we did send a press, so we need to fake a release now
// release all pressed mouse buttons
- /* Qt::MouseButtons mouseButtons = QApplication::mouseButtons();
+ /* Qt::MouseButtons mouseButtons = QGuiApplication::mouseButtons();
for (int i = 0; i < 32; ++i) {
if (mouseButtons & (1 << i)) {
Qt::MouseButton b = static_cast<Qt::MouseButton>(1 << i);
@@ -237,7 +237,7 @@ public:
qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget;
QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway,
- b, mouseButtons, QApplication::keyboardModifiers());
+ b, mouseButtons, QGuiApplication::keyboardModifiers());
sendMouseEvent(&re);
}
}*/
@@ -246,8 +246,8 @@ public:
qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget;
QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, farFarAway,
- mouseButton, QApplication::mouseButtons() & ~mouseButton,
- QApplication::keyboardModifiers(), mouseEventSource);
+ mouseButton, QGuiApplication::mouseButtons() & ~mouseButton,
+ QGuiApplication::keyboardModifiers(), mouseEventSource);
sendMouseEvent(&re, RegrabMouseAfterwards);
// don't clear the mouseTarget just yet, since we need to explicitly ungrab the mouse on release!
}
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 70e5f3678e..0c7bb94a91 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -151,11 +151,11 @@ bool QSystemTrayIconSys::event(QEvent *e)
{
switch (e->type()) {
case QEvent::ToolTip:
- QApplication::sendEvent(q, e);
+ QCoreApplication::sendEvent(q, e);
break;
#if QT_CONFIG(wheelevent)
case QEvent::Wheel:
- return QApplication::sendEvent(q, e);
+ return QCoreApplication::sendEvent(q, e);
#endif
default:
break;
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 5ea8330db2..b9e0d3280f 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -1086,7 +1086,7 @@ bool QAbstractScrollArea::event(QEvent *e)
QScrollBar *vBar = verticalScrollBar();
QPointF delta = g->delta();
if (!delta.isNull()) {
- if (QApplication::isRightToLeft())
+ if (QGuiApplication::isRightToLeft())
delta.rx() *= -1;
int newX = hBar->value() - delta.x();
int newY = vBar->value() - delta.y();
@@ -1325,9 +1325,9 @@ void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
{
Q_D(QAbstractScrollArea);
if (e->orientation() == Qt::Horizontal)
- QApplication::sendEvent(d->hbar, e);
+ QCoreApplication::sendEvent(d->hbar, e);
else
- QApplication::sendEvent(d->vbar, e);
+ QCoreApplication::sendEvent(d->vbar, e);
}
#endif
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 04276aa400..e6e9939a10 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -333,7 +333,7 @@ void QAbstractSpinBox::setReadOnly(bool enable)
d->readOnly = enable;
d->edit->setReadOnly(enable);
QEvent event(QEvent::ReadOnlyChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
update();
}
@@ -574,10 +574,10 @@ QAbstractSpinBox::StepEnabled QAbstractSpinBox::stepEnabled() const
if (d->wrapping)
return StepEnabled(StepUpEnabled | StepDownEnabled);
StepEnabled ret = StepNone;
- if (d->variantCompare(d->value, d->maximum) < 0) {
+ if (QAbstractSpinBoxPrivate::variantCompare(d->value, d->maximum) < 0) {
ret |= StepUpEnabled;
}
- if (d->variantCompare(d->value, d->minimum) > 0) {
+ if (QAbstractSpinBoxPrivate::variantCompare(d->value, d->minimum) > 0) {
ret |= StepDownEnabled;
}
return ret;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index a052f2df79..0b52747b6a 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2618,7 +2618,7 @@ bool QComboBoxPrivate::showNativePopup()
// We need to fake one here to un-press the button.
QMouseEvent mouseReleased(QEvent::MouseButtonRelease, q->pos(), Qt::LeftButton,
Qt::MouseButtons(Qt::LeftButton), Qt::KeyboardModifiers());
- qApp->sendEvent(q, &mouseReleased);
+ QCoreApplication::sendEvent(q, &mouseReleased);
#endif
return true;
@@ -2915,7 +2915,7 @@ void QComboBox::hidePopup()
bool didFade = false;
if (needFade) {
#if defined(Q_OS_MAC)
- QPlatformNativeInterface *platformNativeInterface = qApp->platformNativeInterface();
+ QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface();
int at = platformNativeInterface->metaObject()->indexOfMethod("fadeWindow()");
if (at != -1) {
QMetaMethod windowFade = platformNativeInterface->metaObject()->method(at);
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 1dac496bef..45c72e24d4 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -645,7 +645,7 @@ QDateTimeEdit::Section QDateTimeEdit::currentSection() const
if (QApplication::keypadNavigationEnabled() && d->focusOnButton)
return NoSection;
#endif
- return d->convertToPublic(d->sectionType(d->currentSectionIndex));
+ return QDateTimeEditPrivate::convertToPublic(d->sectionType(d->currentSectionIndex));
}
void QDateTimeEdit::setCurrentSection(Section section)
@@ -659,7 +659,7 @@ void QDateTimeEdit::setCurrentSection(Section section)
int index = d->currentSectionIndex + 1;
for (int i=0; i<2; ++i) {
while (index < size) {
- if (d->convertToPublic(d->sectionType(index)) == section) {
+ if (QDateTimeEditPrivate::convertToPublic(d->sectionType(index)) == section) {
d->edit->setCursorPosition(d->sectionPos(index));
QDTEDEBUG << d->sectionPos(index);
return;
@@ -685,7 +685,7 @@ QDateTimeEdit::Section QDateTimeEdit::sectionAt(int index) const
Q_D(const QDateTimeEdit);
if (index < 0 || index >= d->sectionNodes.size())
return NoSection;
- return d->convertToPublic(d->sectionType(index));
+ return QDateTimeEditPrivate::convertToPublic(d->sectionType(index));
}
/*!
@@ -879,7 +879,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format)
}
d->formatExplicitlySet = true;
- d->sections = d->convertSections(d->display);
+ d->sections = QDateTimeEditPrivate::convertSections(d->display);
d->clearCache();
d->currentSectionIndex = qMin(d->currentSectionIndex, d->sectionNodes.size() - 1);
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index b8b6c12bf3..dc3b77b7bc 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1590,7 +1590,7 @@ bool QDockWidget::event(QEvent *event)
// This is a workaround for loosing the mouse on Vista.
QPoint pos = QCursor::pos();
QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
+ QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
d->mouseMoveEvent(&fake);
}
break;
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index bcc8d7815d..9463641369 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -569,8 +569,8 @@ void qScrollEffect(QWidget* w, QEffects::DirFlags orient, int time)
if (!w)
return;
- QApplication::sendPostedEvents(w, QEvent::Move);
- QApplication::sendPostedEvents(w, QEvent::Resize);
+ QCoreApplication::sendPostedEvents(w, QEvent::Move);
+ QCoreApplication::sendPostedEvents(w, QEvent::Resize);
Qt::WindowFlags flags = Qt::ToolTip;
// those can be popups - they would steal the focus, but are disabled
@@ -591,8 +591,8 @@ void qFadeEffect(QWidget* w, int time)
if (!w)
return;
- QApplication::sendPostedEvents(w, QEvent::Move);
- QApplication::sendPostedEvents(w, QEvent::Resize);
+ QCoreApplication::sendPostedEvents(w, QEvent::Move);
+ QCoreApplication::sendPostedEvents(w, QEvent::Resize);
Qt::WindowFlags flags = Qt::ToolTip;
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 09b7687d8e..68e3de05bc 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -84,7 +84,7 @@
#include "qkeysequence.h"
#define ACCEL_KEY(k) ((!QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus) \
&& QGuiApplication::styleHints()->showShortcutsInContextMenus()) \
- && !qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
+ && !QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(k) ? \
QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
#else
#define ACCEL_KEY(k) QString()
@@ -684,10 +684,10 @@ QSize QLineEdit::sizeHint() const
ensurePolished();
QFontMetrics fm(font());
const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
- int h = qMax(fm.height(), iconSize - 2) + 2*d->verticalMargin
+ int h = qMax(fm.height(), iconSize - 2) + 2 * QLineEditPrivate::verticalMargin
+ d->topTextMargin + d->bottomTextMargin
+ d->topmargin + d->bottommargin;
- int w = fm.horizontalAdvance(QLatin1Char('x')) * 17 + 2*d->horizontalMargin
+ int w = fm.horizontalAdvance(QLatin1Char('x')) * 17 + 2 * QLineEditPrivate::horizontalMargin
+ d->effectiveLeftTextMargin() + d->effectiveRightTextMargin()
+ d->leftmargin + d->rightmargin; // "some"
QStyleOptionFrame opt;
@@ -708,7 +708,7 @@ QSize QLineEdit::minimumSizeHint() const
Q_D(const QLineEdit);
ensurePolished();
QFontMetrics fm = fontMetrics();
- int h = fm.height() + qMax(2*d->verticalMargin, fm.leading())
+ int h = fm.height() + qMax(2 * QLineEditPrivate::verticalMargin, fm.leading())
+ d->topTextMargin + d->bottomTextMargin
+ d->topmargin + d->bottommargin;
int w = fm.maxWidth()
@@ -1606,7 +1606,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
}
#endif
#ifndef QT_NO_CLIPBOARD
- if (QApplication::clipboard()->supportsSelection()) {
+ if (QGuiApplication::clipboard()->supportsSelection()) {
if (e->button() == Qt::LeftButton) {
d->control->copy(QClipboard::Selection);
} else if (!d->control->isReadOnly() && e->button() == Qt::MidButton) {
@@ -1960,17 +1960,18 @@ void QLineEdit::paintEvent(QPaintEvent *)
Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment));
switch (va & Qt::AlignVertical_Mask) {
case Qt::AlignBottom:
- d->vscroll = r.y() + r.height() - fm.height() - d->verticalMargin;
+ d->vscroll = r.y() + r.height() - fm.height() - QLineEditPrivate::verticalMargin;
break;
case Qt::AlignTop:
- d->vscroll = r.y() + d->verticalMargin;
+ d->vscroll = r.y() + QLineEditPrivate::verticalMargin;
break;
default:
//center
d->vscroll = r.y() + (r.height() - fm.height() + 1) / 2;
break;
}
- QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height());
+ QRect lineRect(r.x() + QLineEditPrivate::horizontalMargin, d->vscroll,
+ r.width() - 2 * QLineEditPrivate::horizontalMargin, fm.height());
if (d->shouldShowPlaceholderText()) {
if (!d->placeholderText.isEmpty()) {
@@ -2206,7 +2207,7 @@ QMenu *QLineEdit::createStandardContextMenu()
if (!isReadOnly()) {
action = popup->addAction(QLineEdit::tr("&Paste") + ACCEL_KEY(QKeySequence::Paste));
- action->setEnabled(!d->control->isReadOnly() && !QApplication::clipboard()->text().isEmpty());
+ action->setEnabled(!d->control->isReadOnly() && !QGuiApplication::clipboard()->text().isEmpty());
setActionIcon(action, QStringLiteral("edit-paste"));
connect(action, SIGNAL(triggered()), SLOT(paste()));
}
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index fe3d1663a8..c7b7e5bf97 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -2525,7 +2525,7 @@ bool QMdiArea::event(QEvent *event)
case QEvent::WindowIconChange:
foreach (QMdiSubWindow *window, d->childWindows) {
if (sanityCheck(window, "QMdiArea::WindowIconChange"))
- QApplication::sendEvent(window, event);
+ QCoreApplication::sendEvent(window, event);
}
break;
case QEvent::Hide:
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 685c5e159e..77692930fc 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -1826,7 +1826,7 @@ void QMdiSubWindowPrivate::showButtonsInMenuBar(QMenuBar *menuBar)
// Make sure topLevelWindow->contentsRect returns correct geometry.
// topLevelWidget->updateGeoemtry will not do the trick here since it will post the event.
QEvent event(QEvent::LayoutRequest);
- QApplication::sendEvent(topLevelWindow, &event);
+ QCoreApplication::sendEvent(topLevelWindow, &event);
}
}
@@ -1936,7 +1936,7 @@ QPalette QMdiSubWindowPrivate::desktopPalette() const
#ifndef COLOR_GRADIENTINACTIVECAPTION
#define COLOR_GRADIENTINACTIVECAPTION 28
#endif
- if (QApplication::desktopSettingsAware()) {
+ if (QGuiApplication::desktopSettingsAware()) {
newPalette.setColor(QPalette::Active, QPalette::Highlight,
colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)));
newPalette.setColor(QPalette::Inactive, QPalette::Highlight,
@@ -3050,7 +3050,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent)
d->setActive(false);
if (parentWidget() && testAttribute(Qt::WA_DeleteOnClose)) {
QChildEvent childRemoved(QEvent::ChildRemoved, this);
- QApplication::sendEvent(parentWidget(), &childRemoved);
+ QCoreApplication::sendEvent(parentWidget(), &childRemoved);
}
closeEvent->accept();
}
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 7b6a1b6da8..72653b377d 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -264,7 +264,7 @@ void QMenuPrivate::copyActionToPlatformItem(const QAction *action, QPlatformMenu
item->setIconSize(w->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, w));
} else {
QStyleOption opt;
- item->setIconSize(qApp->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, 0));
+ item->setIconSize(QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, 0));
}
} else {
item->setIcon(QIcon());
@@ -907,7 +907,7 @@ void QMenuPrivate::updateLayoutDirection()
else if (QWidget *w = q->parentWidget())
setLayoutDirection_helper(w->layoutDirection());
else
- setLayoutDirection_helper(QApplication::layoutDirection());
+ setLayoutDirection_helper(QGuiApplication::layoutDirection());
}
}
@@ -1335,7 +1335,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
if (e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),
e->button(), e->buttons(), e->modifiers(), e->source());
- QApplication::sendEvent(caused, &new_e);
+ QCoreApplication::sendEvent(caused, &new_e);
return true;
}
}
@@ -1543,7 +1543,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
if (d->currentAction && d->currentAction == action && !d->currentAction->isSeparator()) {
option->state |= QStyle::State_Selected
- | (d->mouseDown ? QStyle::State_Sunken : QStyle::State_None);
+ | (QMenuPrivate::mouseDown ? QStyle::State_Sunken : QStyle::State_None);
}
option->menuHasCheckableItems = d->hasCheckableItems;
@@ -2362,7 +2362,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
QRect screen;
#if QT_CONFIG(graphicsview)
- bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
+ bool isEmbedded = !bypassGraphicsProxyWidget(this) && QMenuPrivate::nearestGraphicsProxyWidget(this);
if (isEmbedded)
screen = d->popupGeometry();
else
@@ -2698,8 +2698,8 @@ void QMenu::hideEvent(QHideEvent *)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
mb->d_func()->setCurrentAction(0);
#endif
- if (d->mouseDown == this)
- d->mouseDown = 0;
+ if (QMenuPrivate::mouseDown == this)
+ QMenuPrivate::mouseDown = nullptr;
d->hasHadMouse = false;
if (d->activeMenu)
d->hideMenu(d->activeMenu);
@@ -2874,7 +2874,7 @@ void QMenu::mousePressEvent(QMouseEvent *e)
d->hideUpToMenuBar();
return;
}
- d->mouseDown = this;
+ QMenuPrivate::mouseDown = this;
QAction *action = d->actionAt(e->pos());
d->setCurrentAction(action, 20);
@@ -2889,12 +2889,12 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
Q_D(QMenu);
if (d->aboutToHide || d->mouseEventTaken(e))
return;
- if(d->mouseDown != this) {
- d->mouseDown = 0;
+ if (QMenuPrivate::mouseDown != this) {
+ QMenuPrivate::mouseDown = nullptr;
return;
}
- d->mouseDown = 0;
+ QMenuPrivate::mouseDown = nullptr;
d->setSyncAction();
QAction *action = d->actionAt(e->pos());
@@ -2995,7 +2995,7 @@ QMenu::event(QEvent *e)
d->updateActionRects();
break; }
case QEvent::Show:
- d->mouseDown = 0;
+ QMenuPrivate::mouseDown = nullptr;
d->updateActionRects();
d->sloppyState.reset();
if (d->currentAction)
@@ -3385,7 +3385,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) {
QAction *oldAct = mb->d_func()->currentAction;
- QApplication::sendEvent(mb, e);
+ QCoreApplication::sendEvent(mb, e);
if (mb->d_func()->currentAction != oldAct)
key_consumed = true;
}
@@ -3428,7 +3428,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
}
if (e->buttons())
- d->mouseDown = this;
+ QMenuPrivate::mouseDown = this;
if (d->activeMenu)
d->activeMenu->d_func()->setCurrentAction(0);
@@ -3593,7 +3593,7 @@ void QMenu::internalDelayedPopup()
QRect screen;
#if QT_CONFIG(graphicsview)
- bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
+ bool isEmbedded = !bypassGraphicsProxyWidget(this) && QMenuPrivate::nearestGraphicsProxyWidget(this);
if (isEmbedded)
screen = d->popupGeometry();
else
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 9a60f1477d..3d31a3b73a 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -404,7 +404,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat
} else if (previousAction) {
QString empty;
QStatusTipEvent tip(empty);
- QApplication::sendEvent(q, &tip);
+ QCoreApplication::sendEvent(q, &tip);
#endif
}
if (fw)
@@ -701,7 +701,7 @@ void QMenuBarPrivate::init()
q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
q->setAttribute(Qt::WA_CustomWhatsThis);
- if (!QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar))
+ if (!QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuBar))
platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
if (platformMenuBar)
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 4a875975a4..397304ec44 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -1588,7 +1588,7 @@ bool QPlainTextEdit::event(QEvent *e)
d->originalOffsetY = vBar->value();
QPointF offset = g->offset();
if (!offset.isNull()) {
- if (QApplication::isRightToLeft())
+ if (QGuiApplication::isRightToLeft())
offset.rx() *= -1;
// QPlainTextEdit scrolls by lines only in vertical direction
QFontMetrics fm(document()->defaultFont());
@@ -2649,7 +2649,7 @@ void QPlainTextEdit::setReadOnly(bool ro)
d->control->setTextInteractionFlags(flags);
setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
QEvent event(QEvent::ReadOnlyChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
/*!
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 97a3a12336..61ea81c892 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -384,7 +384,7 @@ void QSpinBox::setMinimum(int minimum)
{
Q_D(QSpinBox);
const QVariant m(minimum);
- d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m));
+ d->setRange(m, (QSpinBoxPrivate::variantCompare(d->maximum, m) > 0 ? d->maximum : m));
}
/*!
@@ -412,7 +412,7 @@ void QSpinBox::setMaximum(int maximum)
{
Q_D(QSpinBox);
const QVariant m(maximum);
- d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m);
+ d->setRange((QSpinBoxPrivate::variantCompare(d->minimum, m) < 0 ? d->minimum : m), m);
}
/*!
@@ -864,7 +864,7 @@ void QDoubleSpinBox::setMinimum(double minimum)
Q_D(QDoubleSpinBox);
d->actualMin = minimum;
const QVariant m(d->round(minimum));
- d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m));
+ d->setRange(m, (QDoubleSpinBoxPrivate::variantCompare(d->maximum, m) > 0 ? d->maximum : m));
}
/*!
@@ -895,7 +895,7 @@ void QDoubleSpinBox::setMaximum(double maximum)
Q_D(QDoubleSpinBox);
d->actualMax = maximum;
const QVariant m(d->round(maximum));
- d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m);
+ d->setRange((QDoubleSpinBoxPrivate::variantCompare(d->minimum, m) < 0 ? d->minimum : m), m);
}
/*!
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index bf6bf1c7c9..e39ef6d1cd 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -111,7 +111,7 @@ public:
The user can hide the splash screen by clicking on it with the
mouse. Since the splash screen is typically displayed before the
event loop has started running, it is necessary to periodically
- call QApplication::processEvents() to receive the mouse clicks.
+ call QCoreApplication::processEvents() to receive the mouse clicks.
It is sometimes useful to update the splash screen with messages,
for example, announcing connections established or modules loaded
@@ -170,13 +170,13 @@ void QSplashScreen::mousePressEvent(QMouseEvent *)
/*!
This overrides QWidget::repaint(). It differs from the standard repaint
- function in that it also calls QApplication::processEvents() to ensure
+ function in that it also calls QCoreApplication::processEvents() to ensure
the updates are displayed, even when there is no event loop present.
*/
void QSplashScreen::repaint()
{
QWidget::repaint();
- QApplication::processEvents();
+ QCoreApplication::processEvents();
}
/*!
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index b13f4da9d2..f6f56c12d1 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -843,7 +843,7 @@ void QTabBarPrivate::refresh()
// be safe in case a subclass is also handling move with the tabs
if (pressedIndex != -1
&& movable
- && QApplication::mouseButtons() == Qt::NoButton) {
+ && QGuiApplication::mouseButtons() == Qt::NoButton) {
moveTabFinished(pressedIndex);
if (!validIndex(pressedIndex))
pressedIndex = -1;
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 01f7c34f93..8c1d7e7a03 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -2260,7 +2260,7 @@ void QTextEdit::setReadOnly(bool ro)
d->control->setTextInteractionFlags(flags);
setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
QEvent event(QEvent::ReadOnlyChange);
- QApplication::sendEvent(this, &event);
+ QCoreApplication::sendEvent(this, &event);
}
/*!
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index bcf5a40ae3..fcaafbc581 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1172,7 +1172,7 @@ bool QToolBar::event(QEvent *event)
// This is a workaround for loosing the mouse on Vista.
QPoint pos = QCursor::pos();
QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
+ QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
d->mouseMoveEvent(&fake);
#endif
} else {
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index cf2d885b52..56dba1dd32 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -158,7 +158,7 @@ void QWidgetLineControl::copy(QClipboard::Mode mode) const
{
QString t = selectedText();
if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) {
- QApplication::clipboard()->setText(t, mode);
+ QGuiApplication::clipboard()->setText(t, mode);
}
}
@@ -172,7 +172,7 @@ void QWidgetLineControl::copy(QClipboard::Mode mode) const
*/
void QWidgetLineControl::paste(QClipboard::Mode clipboardMode)
{
- QString clip = QApplication::clipboard()->text(clipboardMode);
+ QString clip = QGuiApplication::clipboard()->text(clipboardMode);
if (!clip.isEmpty() || hasSelectedText()) {
separate(); //make it a separate undo/redo command
insert(clip);
@@ -1524,9 +1524,9 @@ void QWidgetLineControl::setBlinkingCursorEnabled(bool enable)
m_blinkEnabled = enable;
if (enable)
- connect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking);
+ connect(QGuiApplication::styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking);
else
- disconnect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking);
+ disconnect(QGuiApplication::styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking);
updateCursorBlinking();
}
@@ -1680,7 +1680,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
if (hasAcceptableInput() || fixup()) {
- QInputMethod *inputMethod = QApplication::inputMethod();
+ QInputMethod *inputMethod = QGuiApplication::inputMethod();
inputMethod->commit();
QWidget *lineEdit = qobject_cast<QWidget *>(parent());
if (!(lineEdit && lineEdit->inputMethodHints() & Qt::ImhMultiLine))
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index cad3a64749..ccf02da219 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -97,7 +97,7 @@
#include <qkeysequence.h>
#define ACCEL_KEY(k) ((!QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus) \
&& QGuiApplication::styleHints()->showShortcutsInContextMenus()) \
- && !qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
+ && !QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(k) ? \
QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
#else
@@ -648,7 +648,7 @@ void QWidgetTextControlPrivate::_q_updateCurrentCharFormatAndSelection()
#ifndef QT_NO_CLIPBOARD
void QWidgetTextControlPrivate::setClipboardSelection()
{
- QClipboard *clipboard = QApplication::clipboard();
+ QClipboard *clipboard = QGuiApplication::clipboard();
if (!cursor.hasSelection() || !clipboard->supportsSelection())
return;
Q_Q(QWidgetTextControl);
@@ -719,9 +719,9 @@ void QWidgetTextControlPrivate::setCursorVisible(bool visible)
updateCursorBlinking();
if (cursorVisible)
- connect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetTextControlPrivate::updateCursorBlinking);
+ connect(QGuiApplication::styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetTextControlPrivate::updateCursorBlinking);
else
- disconnect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetTextControlPrivate::updateCursorBlinking);
+ disconnect(QGuiApplication::styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetTextControlPrivate::updateCursorBlinking);
}
void QWidgetTextControlPrivate::updateCursorBlinking()
@@ -959,12 +959,12 @@ void QWidgetTextControl::copy()
if (!d->cursor.hasSelection())
return;
QMimeData *data = createMimeDataFromSelection();
- QApplication::clipboard()->setMimeData(data);
+ QGuiApplication::clipboard()->setMimeData(data);
}
void QWidgetTextControl::paste(QClipboard::Mode mode)
{
- const QMimeData *md = QApplication::clipboard()->mimeData(mode);
+ const QMimeData *md = QGuiApplication::clipboard()->mimeData(mode);
if (md)
insertFromMimeData(md);
}
@@ -1787,9 +1787,9 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
selectionChanged(true);
} else if (button == Qt::MidButton
&& (interactionFlags & Qt::TextEditable)
- && QApplication::clipboard()->supportsSelection()) {
+ && QGuiApplication::clipboard()->supportsSelection()) {
setCursorPosition(pos);
- const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection);
+ const QMimeData *md = QGuiApplication::clipboard()->mimeData(QClipboard::Selection);
if (md)
q->insertFromMimeData(md);
#endif
@@ -2598,7 +2598,7 @@ bool QWidgetTextControl::canPaste() const
#ifndef QT_NO_CLIPBOARD
Q_D(const QWidgetTextControl);
if (d->interactionFlags & Qt::TextEditable) {
- const QMimeData *md = QApplication::clipboard()->mimeData();
+ const QMimeData *md = QGuiApplication::clipboard()->mimeData();
return md && canInsertFromMimeData(md);
}
#endif
@@ -3331,7 +3331,7 @@ void QWidgetTextControlPrivate::_q_copyLink()
#ifndef QT_NO_CLIPBOARD
QMimeData *md = new QMimeData;
md->setText(linkToCopy);
- QApplication::clipboard()->setMimeData(md);
+ QGuiApplication::clipboard()->setMimeData(md);
#endif
}