[1/2] Optimize text drawing for QStyleOptionViewItem in QCommonStyle

Optimize isViewItemCached() a bit by reordering conditions so that
conditions that going to change more often in a common case evaluated first.

Change-Id: Ibb406f964345e8f2bff7b433bf33e09a99dcbdc4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
Konstantin Ritt 2013-09-08 08:42:22 +03:00 committed by The Qt Project
parent c49c96fbb1
commit 9d3866ed32

View File

@ -92,19 +92,19 @@ public:
mutable QRect decorationRect, displayRect, checkRect;
mutable QStyleOptionViewItem *cachedOption;
bool isViewItemCached(const QStyleOptionViewItem &option) const {
return cachedOption && (option.rect == cachedOption->rect
&& option.direction == cachedOption->direction
return cachedOption && (option.widget == cachedOption->widget
&& option.index == cachedOption->index
&& option.state == cachedOption->state
&& option.rect == cachedOption->rect
&& option.text == cachedOption->text
&& option.direction == cachedOption->direction
&& option.displayAlignment == cachedOption->displayAlignment
&& option.decorationAlignment == cachedOption->decorationAlignment
&& option.decorationPosition == cachedOption->decorationPosition
&& option.decorationSize == cachedOption->decorationSize
&& option.font == cachedOption->font
&& option.features == cachedOption->features
&& option.widget == cachedOption->widget
&& option.index == cachedOption->index
&& option.icon.isNull() == cachedOption->icon.isNull()
&& option.text == cachedOption->text
&& option.font == cachedOption->font
&& option.viewItemPosition == cachedOption->viewItemPosition);
}
#endif