Permalink
Browse files

QxtCrumbView: don't render delegate for invalid indexes

  • Loading branch information...
1 parent bd5da17 commit f20410afab017aefcb636c915942a23ccdf898dd ahigerd committed Feb 21, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/gui/qxtcrumbview.cpp
View
@@ -132,11 +132,13 @@ class QxtCrumbViewButton : public QAbstractButton {
}
int border = painter.style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
option.rect = option.rect.adjusted(border, border, -border, -border);
- QAbstractItemDelegate* delegate = static_cast<QxtCrumbView*>(parent())->crumbDelegate();
- QStyleOptionViewItem itemOption;
- itemOption.initFrom(this);
- itemOption.rect = option.rect;
- delegate->paint(&painter, itemOption, index);
+ if(index.isValid()) {
+ QAbstractItemDelegate* delegate = static_cast<QxtCrumbView*>(parent())->crumbDelegate();
+ QStyleOptionViewItem itemOption;
+ itemOption.initFrom(this);
+ itemOption.rect = option.rect;
+ delegate->paint(&painter, itemOption, index);
+ }
int arrow = 8;
int pad = (height() - (2 * border) - arrow) / 2;
QStyleOption arrowOption;

0 comments on commit f20410a

Please sign in to comment.