Public Member Functions | |
| QxtCrumbViewButton (const QModelIndex &idx, QxtCrumbView *parent) | |
| QSize | sizeHint () const |
Public Attributes | |
| QModelIndex | index |
Protected Member Functions | |
| void | enterEvent (QEvent *event) |
| void | leaveEvent (QEvent *event) |
| void | paintEvent (QPaintEvent *event) |
Definition at line 98 of file qxtcrumbview.cpp.
| QxtCrumbViewButton::QxtCrumbViewButton | ( | const QModelIndex & | idx, |
| QxtCrumbView * | parent | ||
| ) | [inline] |
Definition at line 100 of file qxtcrumbview.cpp.
: QAbstractButton(parent), index(idx) { // initializers only }
| void QxtCrumbViewButton::enterEvent | ( | QEvent * | event ) | [inline, protected] |
Definition at line 118 of file qxtcrumbview.cpp.
{
Q_UNUSED(event);
update();
}
| void QxtCrumbViewButton::leaveEvent | ( | QEvent * | event ) | [inline, protected] |
Definition at line 123 of file qxtcrumbview.cpp.
{
Q_UNUSED(event);
update();
}
| void QxtCrumbViewButton::paintEvent | ( | QPaintEvent * | event ) | [inline, protected] |
Definition at line 128 of file qxtcrumbview.cpp.
References index.
{
Q_UNUSED(event);
QStylePainter painter(this);
QStyleOptionButton option;
option.initFrom(this);
if(rect().contains(mapFromGlobal(QCursor::pos()))) {
painter.drawPrimitive(QStyle::PE_PanelButtonTool, option);
}
int border = painter.style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
option.rect = option.rect.adjusted(border, border, -border, -border);
QAbstractItemDelegate* delegate = static_cast<QxtCrumbView*>(parent())->itemDelegate();
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;
arrowOption.initFrom(this);
arrowOption.rect = QRect(width() - border - arrow, pad, arrow, arrow);
painter.drawPrimitive(QStyle::PE_IndicatorArrowRight, arrowOption);
}
| QSize QxtCrumbViewButton::sizeHint | ( | ) | const [inline] |
Definition at line 106 of file qxtcrumbview.cpp.
References index.
{
QStyleOptionViewItem itemOption;
itemOption.initFrom(this);
int border = style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
int arrow = 8;
if(index.isValid())
return static_cast<QxtCrumbView*>(parent())->itemDelegate()->sizeHint(itemOption, index) + QSize(border + arrow, border);
else
return QSize(border + arrow, border + arrow);
}
| QModelIndex QxtCrumbViewButton::index |
Definition at line 104 of file qxtcrumbview.cpp.
Referenced by paintEvent(), and sizeHint().
1.7.2