┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private
diff options
context:
space:
mode:
authorJanet Blackquill <[email protected]>2022-03-03 10:57:53 -0500
committerJan Blackquill <[email protected]>2022-03-03 16:02:29 +0000
commite8dc49e4b24f5805d0664fcf842ab7b94af4a013 (patch)
tree84f3a5e41b5fdba6bcdcd2e242149a2670e3c4d5 /src/kitemviews/private
parent505bf52f593a88a07925b0dbba7568535933fd23 (diff)
KItemListHeaderWidget: don't crash if widget == nullptr
BUG: 449238
Diffstat (limited to 'src/kitemviews/private')
-rw-r--r--src/kitemviews/private/kitemlistheaderwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/kitemviews/private/kitemlistheaderwidget.cpp b/src/kitemviews/private/kitemlistheaderwidget.cpp
index 5fb929e52..329e1da56 100644
--- a/src/kitemviews/private/kitemlistheaderwidget.cpp
+++ b/src/kitemviews/private/kitemlistheaderwidget.cpp
@@ -417,12 +417,14 @@ void KItemListHeaderWidget::paintRole(QPainter* painter,
int orderIndex,
QWidget* widget) const
{
+ const auto direction = widget ? widget->layoutDirection() : qApp->layoutDirection();
+
// The following code is based on the code from QHeaderView::paintSection().
// SPDX-FileCopyrightText: 2011 Nokia Corporation and/or its subsidiary(-ies).
QStyleOptionHeader option;
- option.direction = widget->layoutDirection();
+ option.direction = direction;
option.textAlignment =
- widget->layoutDirection() == Qt::LeftToRight
+ direction == Qt::LeftToRight
? Qt::AlignLeft
: Qt::AlignRight;