]> cloud.milkyroute.net Git - dolphin.git/commit
KItemListWidget: Use initStyleOption
authorAnton Kreuzkamp <anton.kreuzkamp@kdab.com>
Mon, 3 Dec 2018 14:01:36 +0000 (15:01 +0100)
committerAnton Kreuzkamp <anton.kreuzkamp@kdab.com>
Mon, 3 Dec 2018 14:15:56 +0000 (15:15 +0100)
commit037d2c9984880065bf8a7e5d189aac1c670e531b
tree1257d8457561df83ef219ac26e81121bb912fafb
parent6100f66ae2ba5ae50c2fcc263b6faaa695d37948
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.
src/kitemviews/kitemlistview.cpp
src/kitemviews/kitemlistwidget.cpp