Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QStyleOptionViewItem QAbstractItemView::viewOptions (  )  const [protected, virtual, inherited]

Returns a QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc.

Reimplemented in QListView, and QTableView.

Definition at line 2755 of file qabstractitemview.cpp.

References QStyleOptionViewItem::decorationAlignment, QStyleOptionViewItem::decorationPosition, QStyleOptionViewItem::decorationSize, QStyleOptionViewItem::displayAlignment, QStyleOptionViewItem::font, QWidget::font, QStyleOption::init(), QStyle::pixelMetric(), QStyleOption::rect, QStyleOptionViewItem::showDecorationSelected, QStyleOption::state, QWidget::style(), QStyle::styleHint(), and QStyleOptionViewItem::textElideMode.

Referenced by QAbstractItemView::openPersistentEditor(), QAbstractItemView::sizeHintForColumn(), QAbstractItemView::sizeHintForIndex(), QAbstractItemView::sizeHintForRow(), QAbstractItemView::updateEditorGeometries(), QTableView::viewOptions(), and QListView::viewOptions().

{
    Q_D(const QAbstractItemView);
    QStyleOptionViewItem option;
    option.init(this);
    option.font = font();
    if (!hasFocus())
        option.state &= ~QStyle::State_Active;

    option.state &= ~QStyle::State_HasFocus;
    if (d->iconSize.isValid()) {
        option.decorationSize = d->iconSize;
    } else {
        int pm = style()->pixelMetric(QStyle::PM_SmallIconSize);
        option.decorationSize = QSize(pm, pm);
    }
    option.decorationPosition = QStyleOptionViewItem::Left;
    option.decorationAlignment = Qt::AlignCenter;
    option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
    option.textElideMode = d->textElideMode;
    option.rect = QRect();
    option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this);
    return option;
}


Generated by  Doxygen 1.6.0   Back to index