int QHeaderView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractItemView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 21) qt_static_metacall(this, _c, _id, _a); _id -= 21; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isSortIndicatorShown(); break; case 1: *reinterpret_cast< bool*>(_v) = highlightSections(); break; case 2: *reinterpret_cast< bool*>(_v) = stretchLastSection(); break; case 3: *reinterpret_cast< bool*>(_v) = cascadingSectionResizes(); break; case 4: *reinterpret_cast< int*>(_v) = defaultSectionSize(); break; case 5: *reinterpret_cast< int*>(_v) = minimumSectionSize(); break; case 6: *reinterpret_cast< Qt::Alignment*>(_v) = defaultAlignment(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSortIndicatorShown(*reinterpret_cast< bool*>(_v)); break; case 1: setHighlightSections(*reinterpret_cast< bool*>(_v)); break; case 2: setStretchLastSection(*reinterpret_cast< bool*>(_v)); break; case 3: setCascadingSectionResizes(*reinterpret_cast< bool*>(_v)); break; case 4: setDefaultSectionSize(*reinterpret_cast< int*>(_v)); break; case 5: setMinimumSectionSize(*reinterpret_cast< int*>(_v)); break; case 6: setDefaultAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
QStyleOptionHeader HierarchicalHeaderView::styleOptionForCell(int logicalInd) const { QStyleOptionHeader opt; initStyleOption(&opt); if (window()->isActiveWindow()) opt.state |= QStyle::State_Active; opt.textAlignment = Qt::AlignCenter; opt.iconAlignment = Qt::AlignVCenter; opt.section = logicalInd; int visual = visualIndex(logicalInd); if (count() == 1) opt.position = QStyleOptionHeader::OnlyOneSection; else { if (visual == 0) opt.position = QStyleOptionHeader::Beginning; else opt.position=(visual==count()-1 ? QStyleOptionHeader::End : QStyleOptionHeader::Middle); } if(isClickable()) { /* if (logicalIndex == d->hover) state |= QStyle::State_MouseOver; if (logicalIndex == d->pressed) { state |= QStyle::State_Sunken; } else*/ { if(highlightSections() && selectionModel()) { if(orientation()==Qt::Horizontal) { if(selectionModel()->columnIntersectsSelection(logicalInd, rootIndex())) opt.state |= QStyle::State_On; if(selectionModel()->isColumnSelected(logicalInd, rootIndex())) opt.state |= QStyle::State_Sunken; } else { if(selectionModel()->rowIntersectsSelection(logicalInd, rootIndex())) opt.state |= QStyle::State_On; if(selectionModel()->isRowSelected(logicalInd, rootIndex())) opt.state |= QStyle::State_Sunken; } } } } if(selectionModel()) { bool previousSelected=false; if(orientation()==Qt::Horizontal) previousSelected = selectionModel()->isColumnSelected(logicalIndex(visual - 1), rootIndex()); else previousSelected = selectionModel()->isRowSelected(logicalIndex(visual - 1), rootIndex()); bool nextSelected=false; if(orientation()==Qt::Horizontal) nextSelected = selectionModel()->isColumnSelected(logicalIndex(visual + 1), rootIndex()); else nextSelected = selectionModel()->isRowSelected(logicalIndex(visual + 1), rootIndex()); if (previousSelected && nextSelected) opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected; else { if (previousSelected) opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected; else { if (nextSelected) opt.selectedPosition = QStyleOptionHeader::NextIsSelected; else opt.selectedPosition = QStyleOptionHeader::NotAdjacent; } } } return opt; }