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/styles/qmacstyle_mac.mm

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5757#include <private/qpainter_p.h>
    5858#include <private/qprintengine_mac_p.h>
    59 #include <private/qstylehelper_p.h>
    6059#include <qapplication.h>
    6160#include <qbitmap.h>
     
    9897#include <qlibrary.h>
    9998#include <qdatetimeedit.h>
     99#include <qmath.h>
    100100#include <QtGui/qgraphicsproxywidget.h>
    101101#include <QtGui/qgraphicsview.h>
    102102#include <private/qt_cocoa_helpers_mac_p.h>
     103#include "qmacstyle_mac_p.h"
     104#include <private/qstylehelper_p.h>
    103105
    104106QT_BEGIN_NAMESPACE
    105 
    106 extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
    107107
    108108// The following constants are used for adjusting the size
    109109// of push buttons so that they are drawn inside their bounds.
    110 static const int PushButtonLeftOffset = 6;
    111 static const int PushButtonTopOffset = 4;
    112 static const int PushButtonRightOffset = 12;
    113 static const int PushButtonBottomOffset = 12;
    114 static const int MiniButtonH = 26;
    115 static const int SmallButtonH = 30;
    116 static const int BevelButtonW = 50;
    117 static const int BevelButtonH = 22;
    118 static const int PushButtonContentPadding = 6;
     110const int QMacStylePrivate::PushButtonLeftOffset = 6;
     111const int QMacStylePrivate::PushButtonTopOffset = 4;
     112const int QMacStylePrivate::PushButtonRightOffset = 12;
     113const int QMacStylePrivate::PushButtonBottomOffset = 12;
     114const int QMacStylePrivate::MiniButtonH = 26;
     115const int QMacStylePrivate::SmallButtonH = 30;
     116const int QMacStylePrivate::BevelButtonW = 50;
     117const int QMacStylePrivate::BevelButtonH = 22;
     118const int QMacStylePrivate::PushButtonContentPadding = 6;
    119119
    120120// These colors specify the titlebar gradient colors on
     
    132132static const QColor mainWindowGradientEnd(200, 200, 200);
    133133
    134 #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
    135 enum {
    136     kThemePushButtonTextured = 31,
    137     kThemePushButtonTexturedSmall = 32,
    138     kThemePushButtonTexturedMini = 33
    139 };
    140 
    141 /* Search fields */
    142 enum {
    143     kHIThemeFrameTextFieldRound = 1000,
    144     kHIThemeFrameTextFieldRoundSmall = 1001,
    145     kHIThemeFrameTextFieldRoundMini = 1002
    146 };
    147 #endif
     134static const int DisclosureOffset = 4;
    148135
    149136// Resolve these at run-time, since the functions was moved in Leopard.
    150137typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
    151138static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
     139
     140static int closeButtonSize = 12;
     141
     142extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
    152143
    153144static bool isVerticalTabs(const QTabBar::Shape shape) {
     
    157148                || shape == QTabBar::TriangularWest);
    158149}
    159 
    160 static int closeButtonSize = 12;
    161150
    162151void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected)
     
    238227        // fill body
    239228        if (active) {
    240             p->fillRect(rect, QColor(151, 151, 151));
     229            int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 16 : 0;
     230            p->fillRect(rect, QColor(151 + d, 151 + d, 151 + d));
    241231        } else {
     232            int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 9 : 0;
    242233            QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
    243             gradient.setColorAt(0, QColor(207, 207, 207));
    244             gradient.setColorAt(0.5, QColor(206, 206, 206));
    245             gradient.setColorAt(1, QColor(201, 201, 201));
     234            gradient.setColorAt(0, QColor(207 + d, 207 + d, 207 + d));
     235            gradient.setColorAt(0.5, QColor(206 + d, 206 + d, 206 + d));
     236            gradient.setColorAt(1, QColor(201 + d, 201 + d, 201 + d));
    246237            p->fillRect(rect, gradient);
    247238        }
     
    376367}
    377368
    378 /*
    379     AHIG:
    380         Apple Human Interface Guidelines
    381         http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/
    382 
    383     Builder:
    384         Apple Interface Builder v. 3.1.1
    385 */
    386 
    387 // this works as long as we have at most 16 different control types
    388 #define CT1(c) CT2(c, c)
    389 #define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))
    390 
    391 enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2,
    392                        QAquaSizeUnknown = -1 };
    393 
    394 #define SIZE(large, small, mini) \
    395     (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini))
    396 
    397 // same as return SIZE(...) but optimized
    398 #define return_SIZE(large, small, mini) \
    399     do { \
    400         static const int sizes[] = { (large), (small), (mini) }; \
    401         return sizes[controlSize]; \
    402     } while (0)
    403 
    404369static int getControlSize(const QStyleOption *option, const QWidget *widget)
    405370{
     
    433398QString qt_mac_removeMnemonics(const QString &original)
    434399{
    435     // copied from qt_format_text (to be bug-for-bug compatible).
    436400    QString returnText(original.size(), 0);
    437401    int finalDest = 0;
     
    439403    int l = original.length();
    440404    while (l) {
    441         if (original.at(currPos) == QLatin1Char('&')) {
     405        if (original.at(currPos) == QLatin1Char('&')
     406            && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
    442407            ++currPos;
    443408            --l;
     
    479444}
    480445
    481 class QMacStylePrivate : public QObject
    482 {
    483     Q_OBJECT
    484 
    485 public:
    486     QMacStylePrivate(QMacStyle *style);
    487 
    488     // Stuff from QAquaAnimate:
    489     bool addWidget(QWidget *);
    490     void removeWidget(QWidget *);
    491 
    492     enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen };
    493     bool animatable(Animates, const QWidget *) const;
    494     void stopAnimate(Animates, QWidget *);
    495     void startAnimate(Animates, QWidget *);
    496     static ThemeDrawState getDrawState(QStyle::State flags);
    497     QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg,
    498                              QStyle::ContentsType ct = QStyle::CT_CustomBase,
    499                              QSize szHint=QSize(-1, -1), QSize *insz = 0) const;
    500     void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider,
    501                           HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe);
    502     bool doAnimate(Animates);
    503     inline int animateSpeed(Animates) const { return 33; }
    504 
    505     // Utility functions
    506     void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi,
    507                              QPainter *p, const QStyleOption *opt) const;
    508 
    509     QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const;
    510 
    511     HIRect pushButtonContentBounds(const QStyleOptionButton *btn,
    512                                    const HIThemeButtonDrawInfo *bdi) const;
    513 
    514     void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi,
    515                         const QWidget *widget, const ThemeDrawState &tds);
    516 
    517     static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind);
    518 
    519     static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi);
    520 
    521     static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p);
    522     static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder,
    523                                      const HIThemeButtonDrawInfo &bdi, QPainter *p);
    524     bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi,
    525                                  ThemeButtonKind buttonKindToCheck) const;
    526     void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget,
    527                                const ThemeDrawState tds,
    528                                HIThemeButtonDrawInfo *bdi) const;
    529     QPixmap generateBackgroundPattern() const;
    530 protected:
    531     bool eventFilter(QObject *, QEvent *);
    532     void timerEvent(QTimerEvent *);
    533 
    534 private slots:
    535     void startAnimationTimer();
    536 
    537 public:
    538     QPointer<QPushButton> defaultButton; //default push buttons
    539     int timerID;
    540     QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation
    541 
    542     struct ButtonState {
    543         int frame;
    544         enum { ButtonDark, ButtonLight } dir;
    545     } buttonState;
    546     UInt8 progressFrame;
    547     QPointer<QFocusFrame> focusWidget;
    548     CFAbsoluteTime defaultButtonStart;
    549     QMacStyle *q;
    550     bool mouseDown;
    551 };
    552 
    553446QT_BEGIN_INCLUDE_NAMESPACE
    554 #include "qmacstyle_mac.moc"
     447#include "moc_qmacstyle_mac.cpp"
     448#include "moc_qmacstyle_mac_p.cpp"
    555449QT_END_INCLUDE_NAMESPACE
    556450
     
    1053947    // carbon not calculating the content bounds fully correct
    1054948    if (bdi->kind == kThemePushButton || bdi->kind == kThemePushButtonSmall){
    1055         outerBounds.origin.y += PushButtonTopOffset;
    1056         outerBounds.size.height -= PushButtonBottomOffset;
     949        outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
     950        outerBounds.size.height -= QMacStylePrivate::PushButtonBottomOffset;
    1057951    } else if (bdi->kind == kThemePushButtonMini) {
    1058         outerBounds.origin.y += PushButtonTopOffset;
     952        outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
    1059953    }
    1060954
     
    1072966    QSize csz(0, 0);
    1073967    QSize iconSize = btn->icon.isNull() ? QSize(0, 0)
    1074                 : (btn->iconSize + QSize(PushButtonContentPadding, 0));
     968                : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0));
    1075969    QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1)
    1076970                : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text);
     
    11471041            // same time displays the button contents without clipping.
    11481042            bdi->kind = kThemeBevelButton;
    1149             if (btn->rect.width() >= BevelButtonW && btn->rect.height() >= BevelButtonH){
     1043            if (btn->rect.width() >= QMacStylePrivate::BevelButtonW && btn->rect.height() >= QMacStylePrivate::BevelButtonH){
    11501044                if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) {
    1151                     if (btn->rect.height() <= MiniButtonH){
     1045                    if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){
    11521046                        if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini))
    11531047                            bdi->kind = kThemePushButtonMini;
    1154                     } else if (btn->rect.height() <= SmallButtonH){
     1048                    } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){
    11551049                        if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall))
    11561050                            bdi->kind = kThemePushButtonSmall;
     
    11641058        }
    11651059    }
     1060}
     1061
     1062bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option)
     1063{
     1064    QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style());
     1065    if (!macStyle)
     1066        return false;
     1067    HIThemeButtonDrawInfo bdi;
     1068    macStyle->d->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi);
     1069    return bdi.kind == kThemeBevelButton;
    11661070}
    11671071
     
    15371441bool QMacStylePrivate::animatable(QMacStylePrivate::Animates as, const QWidget *w) const
    15381442{
     1443    if (!w)
     1444        return false;
     1445
    15391446    if (as == AquaPushButton) {
    15401447        QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w));
     
    19151822        painter->setClipRegion(rgn);
    19161823
    1917         CGContextRef cg = qt_mac_cg_context(target);
     1824        QCFType<CGContextRef> cg = qt_mac_cg_context(target);
    19181825        CGContextSaveGState(cg);
    19191826        HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
     
    21412048        if (qstyleoption_cast<const QStyleOptionComboBox *>(opt) != 0)
    21422049            ret = 0;
     2050        // Frame of mac style line edits is two pixels on top and one on the bottom
     2051        else if (qobject_cast<const QLineEdit *>(widget) != 0)
     2052            ret = 2;
    21432053        else
    2144             ret = QWindowsStyle::pixelMetric(metric, opt, widget);
     2054            ret = 1;
    21452055        break;
    21462056    case PM_MaximumDragDistance:
     
    30953005            bi.value = opt->direction == Qt::LeftToRight ? kThemeDisclosureRight : kThemeDisclosureLeft;
    30963006        bi.adornment = kThemeAdornmentNone;
    3097         HIRect hirect = qt_hirectForQRect(opt->rect);
     3007        HIRect hirect = qt_hirectForQRect(opt->rect.adjusted(DisclosureOffset,0,-DisclosureOffset,0));
    30983008        HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0);
    30993009        break; }
     3010
    31003011    case PE_Frame: {
    31013012        QPen oldPen = p->pen();
    3102         QPen newPen;
    3103         newPen.setBrush(opt->palette.dark());
    3104         p->setPen(newPen);
     3013        p->setPen(opt->palette.base().color().darker(140));
    31053014        p->drawRect(opt->rect.adjusted(0, 0, -1, -1));
     3015        p->setPen(opt->palette.base().color().darker(180));
     3016        p->drawLine(opt->rect.topLeft(), opt->rect.topRight());
    31063017        p->setPen(oldPen);
    31073018        break; }
     3019
    31083020    case PE_FrameLineEdit:
    31093021        if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
     
    31473059    case PE_PanelLineEdit:
    31483060        QWindowsStyle::drawPrimitive(pe, opt, p, w);
     3061        // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
     3062        // Focus frame is drawn outside the rectangle passed in the option-rect.
     3063        if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
     3064            if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) {
     3065                int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin);
     3066                int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
     3067                QStyleOptionFrame focusFrame = *panel;
     3068                focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin);
     3069                drawControl(CE_FocusFrame, &focusFrame, p, w);
     3070            }
     3071        }
     3072
    31493073        break;
    31503074    case PE_FrameTabWidget:
     
    31703094        } break;
    31713095    case PE_FrameStatusBarItem:
    3172         QCommonStyle::drawPrimitive(pe, opt, p, w);
    31733096        break;
    31743097    case PE_IndicatorTabClose: {
     
    32673190                switch (header->position) {
    32683191                case QStyleOptionHeader::Beginning:
     3192                    ir.adjust(-1, -1, 0, 0);
    32693193                    break;
    32703194                case QStyleOptionHeader::Middle:
     3195                    ir.adjust(-1, -1, 0, 0);
     3196                    break;
     3197                case QStyleOptionHeader::OnlyOneSection:
    32713198                case QStyleOptionHeader::End:
    3272                     ir.adjust(-1, 0, 0, 0);
     3199                    ir.adjust(-1, -1, 1, 0);
    32733200                    break;
    32743201                default:
     
    34103337                        QPalette pal = tb->palette;
    34113338                        QPalette::ColorRole role = QPalette::NoRole;
     3339                        if (!proxy()->styleHint(SH_UnderlineShortcut, tb, w))
     3340                            alignment |= Qt::TextHideMnemonic;
    34123341                        if (down)
    34133342                            cr.translate(shiftX, shiftY);
     
    34273356                            }
    34283357                        }
    3429                         drawItemText(p, cr, alignment, pal,
    3430                                      tb->state & State_Enabled, tb->text, role);
     3358                        proxy()->drawItemText(p, cr, alignment, pal,
     3359                                              tb->state & State_Enabled, tb->text, role);
    34313360                        if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 &&
    34323361                            (tb->state & State_Sunken)) {
    34333362                            // Draw a "drop shadow" in earlier versions.
    3434                             drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
    3435                                          tb->palette, tb->state & State_Enabled, tb->text);
     3363                            proxy()->drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
     3364                                                  tb->palette, tb->state & State_Enabled, tb->text);
    34363365                        }
    34373366                    }
     
    34723401            HIRect newRect = qt_hirectForQRect(btn->rect);
    34733402            if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) {
    3474                 newRect.origin.x += PushButtonLeftOffset;
    3475                 newRect.origin.y += PushButtonTopOffset;
    3476                 newRect.size.width -= PushButtonRightOffset;
    3477                 newRect.size.height -= PushButtonBottomOffset;
     3403                newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset;
     3404                newRect.origin.y += QMacStylePrivate::PushButtonTopOffset;
     3405                newRect.size.width -= QMacStylePrivate::PushButtonRightOffset;
     3406                newRect.size.height -= QMacStylePrivate::PushButtonBottomOffset;
    34783407            } else if (bdi.kind == kThemePushButtonMini) {
    3479                 newRect.origin.x += PushButtonLeftOffset - 2;
    3480                 newRect.origin.y += PushButtonTopOffset;
    3481                 newRect.size.width -= PushButtonRightOffset - 4;
     3408                newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset - 2;
     3409                newRect.origin.y += QMacStylePrivate::PushButtonTopOffset;
     3410                newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4;
    34823411            }
    34833412            HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
     
    34863415                int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
    34873416                QRect ir = btn->rect;
    3488                 HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset,
     3417                HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset,
    34893418                                              ir.height() / 2 - 4, mbi, ir.height() / 2);
    34903419                bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
     
    35803509                            state = QIcon::On;
    35813510                        QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state);
    3582                         contentW += pixmap.width() + PushButtonContentPadding;
     3511                        contentW += pixmap.width() + QMacStylePrivate::PushButtonContentPadding;
    35833512                        int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2;
    35843513                        int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2;
     
    35873516                        proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
    35883517                        int newOffset = iconDestRect.x() + iconDestRect.width()
    3589                                         + PushButtonContentPadding - textRect.x();
     3518                                        + QMacStylePrivate::PushButtonContentPadding - textRect.x();
    35903519                        textRect.adjust(newOffset, 0, newOffset, 0);
    35913520                    }
     
    43304259
    43314260    switch (sr) {
     4261    case SE_ItemViewItemText:
     4262        if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
     4263            int fw = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, widget);
     4264            // We add the focusframeargin between icon and text in commonstyle
     4265            rect = QCommonStyle::subElementRect(sr, opt, widget);
     4266            if (vopt->features & QStyleOptionViewItemV2::HasDecoration)
     4267                rect.adjust(-fw, 0, 0, 0);
     4268        }
     4269        break;
    43324270    case SE_ToolBoxTabContents:
    43334271        rect = QCommonStyle::subElementRect(sr, opt, widget);
     
    43474285        if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
    43484286            rect = QWindowsStyle::subElementRect(sr, opt, widget);
    4349             if (widget && widget->height() <= qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)){
    4350                 // We need to allow the text a bit more space when the header is as
    4351                 // small as kThemeMetricListHeaderHeight, otherwise it gets clipped:
     4287            if (widget && widget->height() <= 22){
     4288                // We need to allow the text a bit more space when the header is
     4289                // small, otherwise it gets clipped:
    43524290                rect.setY(0);
    43534291                rect.setHeight(widget->height());
     
    43764314        HIThemeGetButtonShape(&inRect, &bdi, &shape);
    43774315        ptrHIShapeGetBounds(shape, &outRect);
    4378         rect = QRect(int(outRect.origin.x), int(outRect.origin.y),
    4379                   int(contentRect.origin.x - outRect.origin.x), int(outRect.size.height));
     4316        rect = QRect(int(outRect.origin.x + DisclosureOffset), int(outRect.origin.y),
     4317                  int(contentRect.origin.x - outRect.origin.x + DisclosureOffset),
     4318                  int(outRect.size.height));
    43804319        break;
    43814320    }
     
    54195358                    QCFString groupText = qt_mac_removeMnemonics(groupBox->text);
    54205359                    HIThemeGetTextDimensions(groupText, 0, &tti, &width, &height, 0);
    5421                     tw = int(width);
    5422                     h = int(height);
     5360                    tw = qRound(width);
     5361                    h = qCeil(height);
    54235362                } else {
    5424                     QFontMetrics fm = groupBox->fontMetrics;
    5425                     if (!checkable && !fontIsSet)
    5426                         fm = QFontMetrics(qt_app_fonts_hash()->value("QSmallFont", QFont()));
    5427                     h = fm.height();
    5428                     tw = fm.size(Qt::TextShowMnemonic, groupBox->text).width();
     5363                    QFontMetricsF fm = QFontMetricsF(groupBox->fontMetrics);
     5364                    h = qCeil(fm.height());
     5365                    tw = qCeil(fm.size(Qt::TextShowMnemonic, groupBox->text).width());
    54295366                }
    54305367                ret.setHeight(h);
     
    54735410                    yOffset = 5;
    54745411                    if (hasNoText)
    5475                         yOffset = -fm.height();
    5476                 }
    5477 
    5478                 ret = opt->rect.adjusted(0, fm.height() + yOffset, 0, 0);
     5412                        yOffset = -qCeil(QFontMetricsF(fm).height());
     5413                }
     5414
     5415                ret = opt->rect.adjusted(0, qCeil(QFontMetricsF(fm).height()) + yOffset, 0, 0);
    54795416                if (sc == SC_GroupBoxContents)
    54805417                    ret.adjust(3, 3, -3, -4);    // guess
     
    56755612        // Do this by add enough space around the contents so that rounded
    56765613        // borders (including highlighting when active) will show.
    5677         sz.rwidth() += PushButtonLeftOffset + PushButtonRightOffset + 12;
    5678         sz.rheight() += PushButtonTopOffset + PushButtonBottomOffset;
     5614        sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12;
     5615        sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset;
    56795616        break;
    56805617    case QStyle::CT_MenuItem:
     
    57685705        }
    57695706        break;
     5707    case CT_ItemViewItem:
     5708        if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
     5709            sz = QCommonStyle::sizeFromContents(ct, vopt, csz, widget);
     5710            sz.setHeight(sz.height() + 2);
     5711        }
     5712        break;
     5713
    57705714    default:
    57715715        sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget);
Note: See TracChangeset for help on using the changeset viewer.