56    : QPushButton( parent )
 
   58    m_data = 
new PrivateData;
 
   59    m_data->num = qBound( 1, 
num, MaxNum );
 
   62    setAutoRepeat( 
true );
 
   63    setAutoDefault( 
false );
 
   65    switch ( m_data->arrowType )
 
   69            setSizePolicy( QSizePolicy::Expanding,
 
   73            setSizePolicy( QSizePolicy::Fixed,
 
   74                QSizePolicy::Expanding );
 
 
  106    const int m = Margin;
 
  109    r.setRect( r.x() + m, r.y() + m,
 
  110        r.width() - 2 * m, r.height() - 2 * m );
 
  114        QStyleOptionButton option = styleOpt( 
this );
 
  115        const int ph = style()->pixelMetric(
 
  116            QStyle::PM_ButtonShiftHorizontal, &option, 
this );
 
  117        const int pv = style()->pixelMetric(
 
  118            QStyle::PM_ButtonShiftVertical, &option, 
this );
 
  120        r.translate( ph, pv );
 
 
  145    const bool isVertical = m_data->arrowType == Qt::UpArrow ||
 
  146        m_data->arrowType == Qt::DownArrow;
 
  151        boundingSize.transpose();
 
  154        ( boundingSize.width() - ( MaxNum - 1 ) * Spacing ) / MaxNum;
 
  157        QSize( w, boundingSize.height() ) );
 
  163    if ( m_data->arrowType == Qt::LeftArrow || m_data->arrowType == Qt::RightArrow )
 
  165        contentsSize.setWidth( m_data->num * arrow.width()
 
  166            + ( m_data->num - 1 ) * Spacing );
 
  167        contentsSize.setHeight( arrow.height() );
 
  171        contentsSize.setWidth( arrow.width() );
 
  172        contentsSize.setHeight( m_data->num * arrow.height()
 
  173            + ( m_data->num - 1 ) * Spacing );
 
  176    QRect arrowRect( contentsSize );
 
  177    arrowRect.moveCenter( r.center() );
 
  178    arrowRect.setSize( arrow );
 
  181    for ( 
int i = 0; i < m_data->num; i++ )
 
  183        drawArrow( painter, arrowRect, m_data->arrowType );
 
  189            dy = arrow.height() + Spacing;
 
  191            dx = arrow.width() + Spacing;
 
  193        arrowRect.translate( dx, dy );
 
  199        QStyleOptionFocusRect option;
 
  200        option.initFrom( 
this );
 
  201        option.backgroundColor = palette().color( QPalette::Window );
 
  203        style()->drawPrimitive( QStyle::PE_FrameFocusRect,
 
  204            &option, painter, 
this );
 
 
  216    const QRect& r, Qt::ArrowType arrowType )
 const 
  223            pa.setPoint( 0, r.bottomLeft() );
 
  224            pa.setPoint( 1, r.bottomRight() );
 
  225            pa.setPoint( 2, r.center().x(), r.top() );
 
  228            pa.setPoint( 0, r.topLeft() );
 
  229            pa.setPoint( 1, r.topRight() );
 
  230            pa.setPoint( 2, r.center().x(), r.bottom() );
 
  233            pa.setPoint( 0, r.topLeft() );
 
  234            pa.setPoint( 1, r.bottomLeft() );
 
  235            pa.setPoint( 2, r.right(), r.center().y() );
 
  238            pa.setPoint( 0, r.topRight() );
 
  239            pa.setPoint( 1, r.bottomRight() );
 
  240            pa.setPoint( 2, r.left(), r.center().y() );
 
  248    painter->setRenderHint( QPainter::Antialiasing, 
true );
 
  249    painter->setPen( Qt::NoPen );
 
  250    painter->setBrush( palette().brush( QPalette::ButtonText ) );
 
  251    painter->drawPolygon( pa );
 
 
  270    const QSize asz = 
arrowSize( Qt::RightArrow, QSize() );
 
  273        2 * Margin + ( MaxNum - 1 ) * Spacing + MaxNum * asz.width(),
 
  274        2 * Margin + asz.height()
 
  277    if ( m_data->arrowType == Qt::UpArrow || m_data->arrowType == Qt::DownArrow )
 
  280    QStyleOption styleOption;
 
  281    styleOption.initFrom( 
this );
 
  283    sz = style()->sizeFromContents( QStyle::CT_PushButton,
 
  284        &styleOption, sz, 
this );