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

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

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

Reimplemented in QListView, and QTableView.

Definition at line 2207 of file qabstractitemview.cpp.

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

Referenced by QTreeView::doItemsLayout(), QAbstractItemView::edit(), QTreeView::indexRowSizeHint(), QAbstractItemView::openPersistentEditor(), QTreeView::paintEvent(), QTreeView::sizeHintForColumn(), QAbstractItemView::sizeHintForColumn(), QAbstractItemView::sizeHintForIndex(), QAbstractItemView::sizeHintForRow(), QAbstractItemView::startDrag(), QAbstractItemView::updateEditorGeometries(), QTableView::viewOptions(), and QListView::viewOptions().

{
    Q_D(const QAbstractItemView);
    QStyleOptionViewItem option;
    option.init(this);
    option.font = font();
    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 = QStyle::visualAlignment(layoutDirection(),
                                                      Qt::AlignLeft|Qt::AlignVCenter);
    option.textElideMode = d->textElideMode;
    option.rect = QRect();
    option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected);
    return option;
}


Generated by  Doxygen 1.6.0   Back to index