int QwtPushButton::heightForWidth(int width) const
{
    if ( pixmap() )
        return QPushButton::heightForWidth(width);

    QwtText *txt = QwtText::makeText(text(), usedTextFormat(),
        d_alignment, font());

    int h = sizeHint().height();
    h -= txt->boundingRect().height();
    h += txt->heightForWidth(width);

    delete txt;

    return h;
}
예제 #2
0
/*!
  \return The preferred height, for a width.
  \param data Attributes of the legend entry
  \param width Width
*/
int QwtPlotLegendItem::heightForWidth( 
    const QwtLegendData &data, int width ) const
{
    width -= 2 * d_data->itemMargin;

    const QwtGraphic graphic = data.icon();
    const QwtText text = data.title();

    if ( text.isEmpty() )
        return graphic.height();

    if ( graphic.width() > 0 )
        width -= graphic.width() + d_data->itemSpacing;

    int h = text.heightForWidth( width, font() );
    h += 2 * d_data->itemMargin;

    return qMax( graphic.height(), h );
}