Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/styles/qwindowsmobilestyle.cpp

    r651 r769  
    40414041void QWindowsMobileStylePrivate::tintImagesButton(QColor color)
    40424042{
    4043        if (currentTintButton == color)
     4043    if (currentTintButton == color)
    40444044        return;
    4045 
    4046        imageTabEnd = QImage(tabend_xpm);
    4047        imageTabSelectedEnd = QImage(tabselectedend_xpm);
    4048        imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
    4049        imageTabMiddle = QImage(tabmiddle_xpm);
    4050        tintImage(&imageTabEnd, color, 0.0);
    4051        tintImage(&imageTabSelectedEnd, color, 0.0);
    4052        tintImage(&imageTabSelectedBegin, color, 0.0);
    4053        tintImage(&imageTabMiddle, color, 0.0);
    4054 
    4055        if (!doubleControls) {
    4056            int height = imageTabMiddle.height() / 2 + 1;
    4057            imageTabEnd = imageTabEnd.scaledToHeight(height);
    4058            imageTabMiddle = imageTabMiddle.scaledToHeight(height);
    4059            imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
    4060            imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
    4061        }
     4045    currentTintButton = color;
     4046
     4047    imageTabEnd = QImage(tabend_xpm);
     4048    imageTabSelectedEnd = QImage(tabselectedend_xpm);
     4049    imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
     4050    imageTabMiddle = QImage(tabmiddle_xpm);
     4051    tintImage(&imageTabEnd, color, 0.0);
     4052    tintImage(&imageTabSelectedEnd, color, 0.0);
     4053    tintImage(&imageTabSelectedBegin, color, 0.0);
     4054    tintImage(&imageTabMiddle, color, 0.0);
     4055
     4056    if (!doubleControls) {
     4057        int height = imageTabMiddle.height() / 2 + 1;
     4058        imageTabEnd = imageTabEnd.scaledToHeight(height);
     4059        imageTabMiddle = imageTabMiddle.scaledToHeight(height);
     4060        imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
     4061        imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
     4062    }
    40624063}
    40634064
     
    50765077                QImage image;
    50775078                int xoffset, yoffset;
     5079                bool isTabBarArrow = widget && widget->parent()
     5080                                   && widget->inherits("QToolButton")
     5081                                   && widget->parent()->inherits("QTabBar");
     5082
    50785083                switch (element) {
    50795084                    case PE_IndicatorArrowUp:
     
    50905095                          image = d->imageArrowLeft;
    50915096                          xoffset = 8;
    5092                           yoffset = 2;
     5097                          yoffset = isTabBarArrow ? 12 : 2;
    50935098                          break;
    50945099                    case PE_IndicatorArrowRight:
    50955100                          image = d->imageArrowRight;
    50965101                          xoffset = 8;
    5097                           yoffset = 2;
     5102                          yoffset = isTabBarArrow ? 12 : 2;
    50985103                          break;
    50995104                     case PE_IndicatorArrowUpBig:
     
    53525357        painter->drawLines(a);
    53535358        break; }
     5359    case PE_IndicatorBranch: {
     5360        // Copied from the Windows style.
     5361        static const int decoration_size = d->doubleControls ? 18 : 9;
     5362        static const int ofsA  = d->doubleControls ?  4 : 2;
     5363        static const int ofsB  = d->doubleControls ?  8 : 4;
     5364        static const int ofsC  = d->doubleControls ? 12 : 6;
     5365        static const int ofsD  = d->doubleControls ? 1 : 0;
     5366        int mid_h = option->rect.x() + option->rect.width() / 2;
     5367        int mid_v = option->rect.y() + option->rect.height() / 2;
     5368        int bef_h = mid_h;
     5369        int bef_v = mid_v;
     5370        int aft_h = mid_h;
     5371        int aft_v = mid_v;
     5372        if (option->state & State_Children) {
     5373            int delta = decoration_size / 2;
     5374            bef_h -= delta;
     5375            bef_v -= delta;
     5376            aft_h += delta;
     5377            aft_v += delta;
     5378            QPen oldPen = painter->pen();
     5379            QPen crossPen = oldPen;
     5380            crossPen.setWidth(2);
     5381            painter->setPen(crossPen);
     5382            painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD);
     5383            if (!(option->state & State_Open))
     5384                painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD);
     5385            painter->setPen(option->palette.dark().color());
     5386            painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1);
     5387            if (d->doubleControls)
     5388                painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3);
     5389            painter->setPen(oldPen);
     5390        }
     5391        QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern);
     5392        if (option->state & State_Item) {
     5393            if (option->direction == Qt::RightToLeft)
     5394                painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush);
     5395            else
     5396                painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush);
     5397        }
     5398        if (option->state & State_Sibling)
     5399            painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush);
     5400        if (option->state & (State_Open | State_Children | State_Item | State_Sibling))
     5401            painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush);
     5402        break; }
    53545403    case PE_Frame:
    53555404        qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),
     
    69496998        ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness;
    69506999        break;
    6951      case PM_TabBarScrollButtonWidth:
    6952          ret = d->doubleControls ? 14 * 2 : 18;
    6953       case PM_CheckBoxLabelSpacing:
    6954       case PM_RadioButtonLabelSpacing:
     7000    case PM_TabBarScrollButtonWidth:
     7001        ret = d->doubleControls ? 14 * 2 : 18;
     7002        break;
     7003    case PM_CheckBoxLabelSpacing:
     7004    case PM_RadioButtonLabelSpacing:
    69557005        ret = d->doubleControls ? 6 * 2 : 6;
    69567006        break;
Note: See TracChangeset for help on using the changeset viewer.