summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2021-02-03 14:32:43 +0800
committerQt CI Bot <qt_ci_bot@qt-project.org>2021-03-03 11:40:28 +0000
commitb18a845befbd8fb38f78a279de07c4d21ac9460c (patch)
tree5186462dd1b0f8329e072f02e40efa25e0884301 /src
parent6e0ce4ee8005d36ee5d080212b8d83b42ebcae17 (diff)
parentcc7911beb11d69f556f1b5d31d3c4c56b7503086 (diff)
Merge "fix: Print a warning message if the Xcb EGL initialize failed"
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp38
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp6
5 files changed, 33 insertions, 23 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
index 36b971f52d..f3630d57b9 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
@@ -87,7 +87,11 @@ bool QXcbEglIntegration::initialize(QXcbConnection *connection)
m_native_interface_handler.reset(new QXcbEglNativeInterfaceHandler(connection->nativeInterface()));
- qCDebug(lcQpaGl) << "Xcb EGL gl-integration successfully initialized";
+ if (success)
+ qCDebug(lcQpaGl) << "Xcb EGL gl-integration successfully initialized";
+ else
+ qCWarning(lcQpaGl) << "Xcb EGL gl-integration initialize failed";
+
return success;
}
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index be26b2785e..9da290974b 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -225,7 +225,7 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
if (anchorPrivate->hasSize) {
// Anchor has user-defined size
prefSizeHint = anchorPrivate->preferredSize;
- } else {
+ } else if (styleInfo) {
// Fetch size information from style
const Qt::Orientation orient = QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge);
qreal s = styleInfo->defaultSpacing(orient);
@@ -241,6 +241,8 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
s = 0;
}
prefSizeHint = s;
+ } else {
+ prefSizeHint = 0;
}
}
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index e426e09adf..bad40b0cff 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -2652,23 +2652,25 @@ void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bo
// Certain properties are dropped when an item is disabled.
if (!newEnabled) {
- if (scene && scene->mouseGrabberItem() == q_ptr)
- q_ptr->ungrabMouse();
- if (q_ptr->hasFocus()) {
- // Disabling the closest non-panel ancestor of the focus item
- // causes focus to pop to the next item, otherwise it's cleared.
- QGraphicsItem *focusItem = scene->focusItem();
- bool clear = true;
- if (isWidget && !focusItem->isPanel() && q_ptr->isAncestorOf(focusItem)) {
- do {
- if (focusItem == q_ptr) {
- clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true);
- break;
- }
- } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
+ if (scene) {
+ if (scene->mouseGrabberItem() == q_ptr)
+ q_ptr->ungrabMouse();
+ if (q_ptr->hasFocus()) {
+ // Disabling the closest non-panel ancestor of the focus item
+ // causes focus to pop to the next item, otherwise it's cleared.
+ QGraphicsItem *focusItem = scene->focusItem();
+ bool clear = true;
+ if (isWidget && !focusItem->isPanel() && q_ptr->isAncestorOf(focusItem)) {
+ do {
+ if (focusItem == q_ptr) {
+ clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true);
+ break;
+ }
+ } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
+ }
+ if (clear)
+ q_ptr->clearFocus();
}
- if (clear)
- q_ptr->clearFocus();
}
if (q_ptr->isSelected())
q_ptr->setSelected(false);
@@ -7149,14 +7151,14 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if ((item->flags() & ItemIsMovable) && !QGraphicsItemPrivate::movableAncestorIsSelected(item)) {
QPointF currentParentPos;
QPointF buttonDownParentPos;
- if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorIgnoresTransformations) {
+ if (view && (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorIgnoresTransformations)) {
// Items whose ancestors ignore transformations need to
// map screen coordinates to local coordinates, then map
// those to the parent.
QTransform viewToItemTransform = (item->deviceTransform(view->viewportTransform())).inverted();
currentParentPos = mapToParent(viewToItemTransform.map(QPointF(view->mapFromGlobal(event->screenPos()))));
buttonDownParentPos = mapToParent(viewToItemTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton)))));
- } else if (item->flags() & ItemIgnoresTransformations) {
+ } else if (view && (item->flags() & ItemIgnoresTransformations)) {
// Root items that ignore transformations need to
// calculate their diff by mapping viewport coordinates
// directly to parent coordinates.
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index fea9e18b9c..a4b1b8ea6c 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -2143,7 +2143,7 @@ void QGraphicsWidget::setTabOrder(QGraphicsWidget *first, QGraphicsWidget *secon
return;
}
QGraphicsScene *scene = first ? first->scene() : second->scene();
- if (!scene && (!first || !second)) {
+ if (!scene) {
qWarning("QGraphicsWidget::setTabOrder: assigning tab order from/to the"
" scene requires the item to be in a scene.");
return;
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index 0580c6d938..d989455596 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -784,7 +784,8 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
// detach from current focus chain; skip this widget subtree.
focusBefore->d_func()->focusNext = focusAfter;
- focusAfter->d_func()->focusPrev = focusBefore;
+ if (focusAfter)
+ focusAfter->d_func()->focusPrev = focusBefore;
if (newParent) {
// attach to new parent's focus chain as the last element
@@ -800,7 +801,8 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
newFocusLast->d_func()->focusNext = q;
focusLast->d_func()->focusNext = newFocusAfter;
- newFocusAfter->d_func()->focusPrev = focusLast;
+ if (newFocusAfter)
+ newFocusAfter->d_func()->focusPrev = focusLast;
focusPrev = newFocusLast;
} else {
// no new parent, so just link up our own prev->last widgets.