KItemListWidget: Use initStyleOption

Authored by akreuzkamp on Dec 3 2018, 2:01 PM.

Description

KItemListWidget: Use initStyleOption

Instead of using QStyleOption::initFrom, let's use
QGraphicsWidget::initStyleOption, which is made for exactly the purpose
of KItemListWidget. This is especially important since, according to the
docs of QGraphicsItem::paint "The widget argument is optional. [...]
For cached painting, widget is always 0.". Even though currently no code
in dolphin does cached painting, for the sake of modularity one should
not rely on widget to be non-null. Using QStyleOption::initFrom does
assume that, though.

In fact, GammaRay asks the items to do cached painting when attaching it
to the application, causing it to crash.

Details

Committed
akreuzkampDec 3 2018, 2:15 PM
Parents
R318:6100f66ae2ba: Fix selection when navigating back, with size sorting.
Branches
Unknown
Tags
Unknown