QRect KSelector::contentsRect() const { int w = indent() ? style()->pixelMetric( QStyle::PM_DefaultFrameWidth ) : 0; //TODO: is the height:width ratio of an indicator arrow always 2:1? hm. int iw = (w < ARROWSIZE) ? ARROWSIZE : w; if ( orientation() == Qt::Vertical ) { if ( arrowDirection() == Qt::RightArrow ) { return QRect( w + ARROWSIZE, iw, width() - w*2 - ARROWSIZE, height() - iw*2 ); } else { return QRect( w, iw, width() - w*2 - ARROWSIZE, height() - iw*2 ); } } else { // Qt::Horizontal if ( arrowDirection() == Qt::UpArrow ) { return QRect( iw, w, width() - 2*iw, height() - w*2 - ARROWSIZE ); } else { return QRect( iw, w + ARROWSIZE, width() - 2*iw, height() - w*2 - ARROWSIZE ); } } }
QRect DSelector::contentsRect() const { int w = indent() ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0; int iw = (w < d->arrowsize) ? d->arrowsize : w; if (orientation() == Qt::Vertical) { if (arrowDirection() == Qt::RightArrow) { return QRect(w + d->arrowsize, iw, width() - w*2 - d->arrowsize, height() - iw*2); } else { return QRect(w, iw, width() - w*2 - d->arrowsize, height() - iw*2); } } else { // Qt::Horizontal if (arrowDirection() == Qt::UpArrow) { return QRect(iw, w, width() - 2*iw, height() - w*2 - d->arrowsize); } else { return QRect(iw, w + d->arrowsize, width() - 2*iw, height() - w*2 - d->arrowsize); } } }