Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qcommandlinkbutton.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    4747#include "qcolor.h"
    4848#include "qfont.h"
     49
    4950
    5051#include "private/qpushbutton_p.h"
     
    118119    int leftMargin() const { return 7; }
    119120    int rightMargin() const { return 4; }
    120     int bottomMargin() const { return 4; }
     121    int bottomMargin() const { return ; }
    121122
    122123    QString description;
     
    174175{
    175176    Q_Q(const QCommandLinkButton);
    176     return q->rect().adjusted(textOffset(), topMargin(),
    177                               -rightMargin(), 0);
     177    QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0);
     178    if (description.isEmpty())
     179    {
     180        QFontMetrics fm(titleFont());
     181        r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height()
     182                 - fm.height()) / 2));
     183    }
     184
     185    return r;
    178186}
    179187
     
    243251        layout.endLayout();
    244252    }
    245     return qRound(descriptionheight);
     253    return q(descriptionheight);
    246254}
    247255
     
    254262    QSize size = sizeHint();
    255263    int minimumHeight = qMax(d->descriptionOffset() + d->bottomMargin(),
    256                              iconSize().height() + d->topMargin());
     264                             icon).height() + d->topMargin());
    257265    size.setHeight(minimumHeight);
    258266    return size;
     
    328336    // find the width available for the description area
    329337    return qMax(heightWithoutDescription + d->descriptionHeight(width),
    330                 iconSize().height() + d->topMargin() + d->bottomMargin());
     338                icon().actualSize(iconSize()).height() + d->topMargin() +
     339                d->bottomMargin());
    331340}
    332341
     
    341350    initStyleOption(&option);
    342351
    343     //Enable command link appearence on Vista
     352    //Enable command link appearnce on Vista
    344353    option.features |= QStyleOptionButton::CommandLinkButton;
    345354    option.text = QString();
Note: See TracChangeset for help on using the changeset viewer.