Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QSize QRadioButton::sizeHint (  )  const [virtual]

Reimplemented from QWidget.

Definition at line 185 of file qradiobutton.cpp.

References QWidget::ensurePolished(), QWidget::fontMetrics(), QSize::height(), QStyleOptionButton::icon, QStyleOptionButton::iconSize, initStyleOption(), QIcon::isNull(), QStyle::itemTextRect(), QRect::size(), QStyle::sizeFromContents(), QWidget::style(), QAbstractButton::text, and QSize::width().

{
    Q_D(const QRadioButton);
    if (d->sizeHint.isValid())
        return d->sizeHint;
    ensurePolished();
    QStyleOptionButton opt;
    initStyleOption(&opt);
    QSize sz = style()->itemTextRect(fontMetrics(), QRect(0, 0, 1, 1), Qt::TextShowMnemonic,
                                     false, text()).size();
    if (!opt.icon.isNull())
        sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height()));
    d->sizeHint = (style()->sizeFromContents(QStyle::CT_RadioButton, &opt, sz, this).
                  expandedTo(QApplication::globalStrut()));
    return d->sizeHint;
}


Generated by  Doxygen 1.6.0   Back to index