QRect QSpreadsheetHeaderView::nextRect(int logicalIndex) const { if (isSectionHidden(logicalIndex)) return QRect(); QRect sr = sectionRect(logicalIndex); return QRect(sr.right() - 13, sr.center().y() - 6, 13, 13); }
bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e) { if (e->type() == QEvent::MouseMove) { const int section = sectionAt(static_cast<QMouseEvent*>(e)->x()); if (section != m_lastToolTipSection && section >= 0 && section < (int)m_toolTips.count()) { //QToolTip::remove(this, m_toolTipRect); #ifdef __GNUC__ #warning TODO KexiTableViewHeader::eventFilter #else #pragma WARNING( TODO KexiTableViewHeader::eventFilter ) #endif QString tip = m_toolTips[ section ]; if (tip.isEmpty()) { //try label QFontMetrics fm(font()); int minWidth = fm.width(label(section)) + style()->pixelMetric(QStyle::PM_HeaderMargin); QIcon *iset = iconSet(section); if (iset) minWidth += (2 + iset->pixmap(IconSize(KIconLoader::Small)).width()); //taken from QHeader::sectionSizeHint() if (minWidth > sectionSize(section)) tip = label(section); } if (tip.isEmpty()) { m_lastToolTipSection = -1; } else { #ifdef __GNUC__ #warning QToolTip::showText() OK? #else #pragma WARNING( QToolTip::showText() OK? ) #endif QToolTip::showText(static_cast<QMouseEvent*>(e)->globalPos(), tip, this, m_toolTipRect = sectionRect(section)); m_lastToolTipSection = section; } } } else if (e->type() == QEvent::ToolTip) { // QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e); #ifdef __GNUC__ #warning TODO #else #pragma WARNING( TODO ) #endif } // if (e->type()==QEvent::MouseButtonPress) { // todo // } return Q3Header::eventFilter(watched, e); }
QRect QSpreadsheetHeaderView::buttonMenuRect(int logicalIndex) const { QRect sr = sectionRect(logicalIndex); return QRect(sr.right() - 5 - 13, sr.center().y() - 6, 13, 13); }