#include "qstylesheetstyle_p.h"
#include <qdebug.h>
#include <qapplication.h>
#include <qmenu.h>
#include <qmenubar.h>
#include <qpainter.h>
#include <qstyleoption.h>
#include <qlineedit.h>
#include <qwindowsstyle.h>
#include <qcombobox.h>
#include <qplastiquestyle.h>
#include "private/qcssparser_p.h"
#include "private/qmath_p.h"
#include <qabstractscrollarea.h>
#include <qtooltip.h>
#include <qshareddata.h>
#include <qradiobutton.h>
#include "moc_qstylesheetstyle_p.cpp"
Include dependency graph for qstylesheetstyle.cpp:

Go to the source code of this file.
Classes | |
| struct | QStyleSheetBorderImageData |
| struct | QStyleSheetBackgroundData |
| struct | QStyleSheetBorderData |
| struct | QStyleSheetBoxData |
| struct | QStyleSheetPaletteData |
| struct | QStyleSheetGeometryData |
| struct | QStyleSheetPositionData |
| class | QRenderRule |
| class | QStyleSheetStyleSelector |
| struct | PseudoElementInfo |
Defines | |
| #define | ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) |
| #define | WIDGET(x) (static_cast<QWidget *>(x.ptr)) |
Typedefs | |
| typedef QHash< QString, QHash< int, QRenderRule > > | QRenderRules |
Enumerations | |
| enum | PseudoElement |
Functions | |
| static void | initStatics () |
| static QPen | qPenFromStyle (const QBrush &b, qreal width, BorderStyle s) |
| static void | qDrawRoundedCorners (QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, const QSizeF &r1, const QSizeF &r2, Edge edge, BorderStyle s, QColor c) |
| void | qDrawEdge (QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, qreal dw2, Edge edge, BorderStyle style, QColor c) |
| static void | qDrawCenterTiledPixmap (QPainter *p, const QRectF &r, const QPixmap &pix) |
| static QVector< QCss::StyleRule > | styleRules (QWidget *w) |
| static Qt::Alignment | defaultPosition (int pe) |
| static QSize | expandedSize (QSize sz, const QRect &rect, int pe) |
| static QRect | positionRect (const QRenderRule &rule1, const QRenderRule &rule2, int pe, const QRect &rect, Qt::LayoutDirection dir) |
| static QWidget * | embeddedWidget (QWidget *w) |
| static void | unsetPalette (QWidget *w) |
| static void | updateWidget (QWidget *widget) |
| static void | updateWidgets (const QList< const QWidget * > &widgets) |
| static bool | unstylable (QWidget *w) |
Variables | |
| static QHash< const QWidget *, QVector< StyleRule > > * | styleRulesCache = 0 |
| static QHash< const QWidget *, QRenderRules > * | renderRulesCache = 0 |
| static QHash< const QWidget *, int > * | customPaletteWidgets = 0 |
| static QHash< const QWidget *, int > * | customFontWidgets = 0 |
| static QHash< const QWidget *, StyleSheet > * | styleSheetCache = 0 |
| static const char * | knownStyleHints [] |
| static const char ** | endKnownStyleHints = knownStyleHints + sizeof(knownStyleHints)/sizeof(char *) |
| static struct PseudoElementInfo | knownPseudoElements [NumPseudoElements] |
| #define ceil | ( | x | ) | ((int)(x) + ((x) > 0 && (x) != (int)(x))) |
Definition at line 55 of file qstylesheetstyle.cpp.
Referenced by QFontEngine::alphaMapForGlyph(), QSvgAnimateColor::apply(), DocumentShape::DocumentShape(), QPainterPrivate::draw_helper(), QRenderRule::drawBorderImage(), QPaintEngine::drawImage(), drawTextItemDecoration(), ImageShape::ImageShape(), pathArc(), qt_curves_for_arc(), QSvgAnimateTransform::resolveMatrix(), and QPicturePaintEngine::writeCmdLength().
Definition at line 1179 of file qstylesheetstyle.cpp.
Referenced by QStyleSheetStyleSelector::attribute(), QStyleSheetStyleSelector::hasAttribute(), QStyleSheetStyleSelector::nodeIds(), QStyleSheetStyleSelector::nodeNameEquals(), and QStyleSheetStyleSelector::parentNode().
| typedef QHash<QString, QHash<int, QRenderRule> > QRenderRules |
Definition at line 49 of file qstylesheetstyle.cpp.
| enum PseudoElement |
Definition at line 1270 of file qstylesheetstyle.cpp.
01270 { 01271 PseudoElement_None, 01272 PseudoElement_DownArrow, 01273 PseudoElement_UpArrow, 01274 PseudoElement_LeftArrow, 01275 PseudoElement_RightArrow, 01276 PseudoElement_Indicator, 01277 PseudoElement_MenuIndicator, 01278 PseudoElement_DropDown, 01279 PseudoElement_DropDownArrow, 01280 PseudoElement_Item, 01281 PseudoElement_SpinBoxUpButton, 01282 PseudoElement_SpinBoxUpArrow, 01283 PseudoElement_SpinBoxDownButton, 01284 PseudoElement_SpinBoxDownArrow, 01285 PseudoElement_GroupBoxTitle, 01286 PseudoElement_GroupBoxIndicator, 01287 NumPseudoElements 01288 };
| static Qt::Alignment defaultPosition | ( | int | pe | ) | [static] |
Definition at line 1447 of file qstylesheetstyle.cpp.
References Qt::AlignBottom, Qt::AlignCenter, Qt::AlignLeft, Qt::AlignRight, Qt::AlignTop, Qt::AlignVCenter, PseudoElement_DownArrow, PseudoElement_DropDown, PseudoElement_DropDownArrow, PseudoElement_GroupBoxIndicator, PseudoElement_GroupBoxTitle, PseudoElement_Indicator, PseudoElement_MenuIndicator, PseudoElement_SpinBoxDownArrow, PseudoElement_SpinBoxDownButton, PseudoElement_SpinBoxUpArrow, and PseudoElement_SpinBoxUpButton.
Referenced by positionRect().
01448 { 01449 switch (pe) { 01450 case PseudoElement_SpinBoxUpButton: 01451 case PseudoElement_SpinBoxDownButton: 01452 return (pe == PseudoElement_SpinBoxUpButton) ? Qt::AlignTop | Qt::AlignRight 01453 : Qt::AlignBottom | Qt::AlignRight; 01454 case PseudoElement_Indicator: 01455 return Qt::AlignLeft | Qt::AlignVCenter; 01456 case PseudoElement_DropDown: 01457 return Qt::AlignTop | Qt::AlignRight; 01458 case PseudoElement_DropDownArrow: 01459 case PseudoElement_SpinBoxDownArrow: 01460 case PseudoElement_SpinBoxUpArrow: 01461 case PseudoElement_DownArrow: 01462 return Qt::AlignCenter; 01463 case PseudoElement_MenuIndicator: 01464 return Qt::AlignBottom | Qt::AlignRight; 01465 case PseudoElement_GroupBoxTitle: 01466 case PseudoElement_GroupBoxIndicator: 01467 return Qt::AlignTop | Qt::AlignLeft; 01468 default: 01469 return 0; 01470 } 01471 }
Definition at line 1534 of file qstylesheetstyle.cpp.
References w.
Referenced by QStyleSheetStyle::setPalette().
01535 { 01536 #ifndef QT_NO_COMBOBOX 01537 if (QComboBox *cmb = qobject_cast<QComboBox *>(w)) 01538 if (cmb->isEditable()) 01539 return cmb->lineEdit(); 01540 else 01541 return cmb; 01542 #endif 01543 01544 #ifndef QT_NO_SPINBOX 01545 if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w)) 01546 return qFindChild<QLineEdit *>(sb); 01547 #endif 01548 01549 #ifndef QT_NO_SCROLLAREA 01550 if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) 01551 return sa->viewport(); 01552 #endif 01553 01554 return w; 01555 }
Definition at line 1473 of file qstylesheetstyle.cpp.
References QRect::height(), QSize::height(), PseudoElement_DropDown, PseudoElement_SpinBoxDownButton, PseudoElement_SpinBoxUpButton, QSize::setHeight(), QSize::setWidth(), QRect::width(), and QSize::width().
Referenced by positionRect().
01474 { 01475 // some magic for relative positioning since we don't support % metrics yet 01476 switch (pe) { 01477 case PseudoElement_SpinBoxUpButton: 01478 case PseudoElement_SpinBoxDownButton: 01479 if (sz.height() == -1) 01480 sz.setHeight(rect.height()/2); 01481 break; 01482 case PseudoElement_DropDown: 01483 if (sz.height() == -1) 01484 sz.setHeight(rect.height()); 01485 break; 01486 default: 01487 break; 01488 } 01489 01490 // expand to rectangle 01491 if (sz.height() == -1) 01492 sz.setHeight(rect.height()); 01493 if (sz.width() == -1) 01494 sz.setWidth(rect.width()); 01495 01496 return sz; 01497 }
Here is the call graph for this function:

| static void initStatics | ( | ) | [static] |
Definition at line 57 of file qstylesheetstyle.cpp.
References customFontWidgets, customPaletteWidgets, renderRulesCache, styleRulesCache, and styleSheetCache.
Referenced by QStyleSheetStyle::QStyleSheetStyle().
00058 { 00059 static bool initialized = false; 00060 if (initialized) 00061 return; 00062 initialized = true; 00063 styleRulesCache = new QHash<const QWidget *, QVector<StyleRule> >; 00064 renderRulesCache = new QHash<const QWidget *, QRenderRules>; 00065 customPaletteWidgets = new QHash<const QWidget *, int>; 00066 customFontWidgets = new QHash<const QWidget *, int>; 00067 styleSheetCache = new QHash<const QWidget *, StyleSheet>; 00068 }
| static QRect positionRect | ( | const QRenderRule & | rule1, | |
| const QRenderRule & | rule2, | |||
| int | pe, | |||
| const QRect & | rect, | |||
| Qt::LayoutDirection | dir | |||
| ) | [static] |
Definition at line 1499 of file qstylesheetstyle.cpp.
References QStyle::alignedRect(), defaultPosition(), expandedSize(), QSize::expandedTo(), QRenderRule::hasContentsSize(), QTextStream::left(), Qt::LeftToRight, QRenderRule::minimumContentsSize(), QCss::Origin_Padding, QCss::Origin_Unknown, QRenderRule::originRect(), p, QRenderRule::position(), QCss::PositionMode_Absolute, QCss::PositionMode_Static, and QRenderRule::size().
Referenced by QStyleSheetStyle::drawComplexControl(), QStyleSheetStyle::drawControl(), QStyleSheetStyle::subControlRect(), and QStyleSheetStyle::subElementRect().
01501 { 01502 Origin defOrigin = Origin_Padding; 01503 Qt::Alignment defPosition = defaultPosition(pe); 01504 01505 const QStyleSheetPositionData *p = rule2.position(); 01506 Origin origin = (p && p->origin != Origin_Unknown) ? p->origin : defOrigin; 01507 QRect originRect = rule1.originRect(rect, origin); 01508 PositionMode mode = p ? p->mode : PositionMode_Static; 01509 Qt::Alignment position = (p && p->position != 0) ? p->position : defPosition; 01510 QRect r; 01511 01512 if (mode != PositionMode_Absolute) { 01513 QSize sz = expandedSize(rule2.size(), originRect, pe); 01514 sz = sz.expandedTo(rule2.minimumContentsSize()); 01515 r = QStyle::alignedRect(dir, position, sz, originRect); 01516 if (p) { 01517 int left = p->left ? p->left : -p->right; 01518 int top = p->top ? p->top : -p->bottom; 01519 r.translate(dir == Qt::LeftToRight ? left : -left, top); 01520 } 01521 } else { 01522 if (p) 01523 r = originRect.adjusted(dir == Qt::LeftToRight ? p->left : p->right, p->top, 01524 dir == Qt::LeftToRight ? -p->right : -p->left, -p->bottom); 01525 if (rule2.hasContentsSize()) { 01526 QSize sz = expandedSize(rule2.size(), r, pe); 01527 sz = sz.expandedTo(rule2.minimumContentsSize()); 01528 r = QStyle::alignedRect(dir, position, sz, r); 01529 } 01530 } 01531 return r; 01532 }
Here is the call graph for this function:

Definition at line 804 of file qstylesheetstyle.cpp.
References QRectF::height(), QPixmap::height(), int, p, QPixmap::width(), and QRectF::width().
Referenced by QRenderRule::drawBorderImage().
00805 { 00806 p->drawTiledPixmap(r, pix, QPoint(pix.width() - int(r.width())%pix.width(), 00807 pix.height() - int(r.height())%pix.height())); 00808 }
Here is the call graph for this function:

| void qDrawEdge | ( | QPainter * | p, | |
| qreal | x1, | |||
| qreal | y1, | |||
| qreal | x2, | |||
| qreal | y2, | |||
| qreal | dw1, | |||
| qreal | dw2, | |||
| Edge | edge, | |||
| BorderStyle | style, | |||
| QColor | c | |||
| ) |
Definition at line 659 of file qstylesheetstyle.cpp.
References QPainter::Antialiasing, QCss::BorderStyle_Dashed, QCss::BorderStyle_DotDash, QCss::BorderStyle_DotDotDash, QCss::BorderStyle_Dotted, QCss::BorderStyle_Double, QCss::BorderStyle_Groove, QCss::BorderStyle_Inset, QCss::BorderStyle_Outset, QCss::BorderStyle_Ridge, QCss::BorderStyle_Solid, QCss::BottomEdge, c, QCss::LeftEdge, Qt::NoPen, p, qFloor(), qPenFromStyle(), qRound(), QCss::RightEdge, s1, s2, and QCss::TopEdge.
Referenced by QRenderRule::drawBorder().
00661 { 00662 p->save(); 00663 p->setRenderHint(QPainter::Antialiasing); 00664 const qreal width = (edge == TopEdge || edge == BottomEdge) ? (y2-y1) : (x2-x1); 00665 00666 if (width <= 2 && style == BorderStyle_Double) 00667 style = BorderStyle_Solid; 00668 00669 switch (style) { 00670 case BorderStyle_Inset: 00671 case BorderStyle_Outset: 00672 if (style == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge) 00673 || (style == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge))) 00674 c = c.light(); 00675 // fall through! 00676 case BorderStyle_Solid: { 00677 p->setPen(Qt::NoPen); 00678 p->setBrush(c); 00679 if (width == 1 || (dw1 == 0 && dw2 == 0)) { 00680 p->drawRect(QRectF(x1, y1, x2-x1, y2-y1)); 00681 } else { // draw trapezoid 00682 QPolygonF quad; 00683 switch (edge) { 00684 case TopEdge: 00685 quad << QPointF(x1, y1) << QPointF(x1 + dw1, y2) 00686 << QPointF(x2 - dw2, y2) << QPointF(x2, y1); 00687 break; 00688 case BottomEdge: 00689 quad << QPointF(x1 + dw1, y1) << QPointF(x1, y2) 00690 << QPointF(x2, y2) << QPointF(x2 - dw2, y1); 00691 break; 00692 case LeftEdge: 00693 quad << QPointF(x1, y1) << QPointF(x1, y2) 00694 << QPointF(x2, y2 - dw2) << QPointF(x2, y1 + dw1); 00695 break; 00696 case RightEdge: 00697 quad << QPointF(x1, y1 + dw1) << QPointF(x1, y2 - dw2) 00698 << QPointF(x2, y2) << QPointF(x2, y1); 00699 break; 00700 default: 00701 break; 00702 } 00703 p->drawConvexPolygon(quad); 00704 } 00705 break; 00706 } 00707 case BorderStyle_Dotted: 00708 case BorderStyle_Dashed: 00709 case BorderStyle_DotDash: 00710 case BorderStyle_DotDotDash: 00711 p->setPen(qPenFromStyle(c, width, style)); 00712 if (width == 1) 00713 p->drawLine(QLineF(x1, y1, x2 - 1, y2 - 1)); 00714 else if (edge == TopEdge || edge == BottomEdge) 00715 p->drawLine(QLineF(x1 + width/2, (y1 + y2)/2, x2 - width/2, (y1 + y2)/2)); 00716 else 00717 p->drawLine(QLineF((x1+x2)/2, y1 + width/2, (x1+x2)/2, y2 - width/2)); 00718 break; 00719 00720 case BorderStyle_Double: { 00721 int wby3 = qRound(width/3); 00722 int dw1by3 = qRound(dw1/3); 00723 int dw2by3 = qRound(dw2/3); 00724 switch (edge) { 00725 case TopEdge: 00726 qDrawEdge(p, x1, y1, x2, y1 + wby3, dw1by3, dw2by3, TopEdge, BorderStyle_Solid, c); 00727 qDrawEdge(p, x1 + dw1 - dw1by3, y2 - wby3, x2 - dw2 + dw1by3, y2, 00728 dw1by3, dw2by3, TopEdge, BorderStyle_Solid, c); 00729 break; 00730 case LeftEdge: 00731 qDrawEdge(p, x1, y1, x1 + wby3, y2, dw1by3, dw2by3, LeftEdge, BorderStyle_Solid, c); 00732 qDrawEdge(p, x2 - wby3, y1 + dw1 - dw1by3, x2, y2 - dw2 + dw2by3, dw1by3, dw2by3, 00733 LeftEdge, BorderStyle_Solid, c); 00734 break; 00735 case BottomEdge: 00736 qDrawEdge(p, x1 + dw1 - dw1by3, y1, x2 - dw2 + dw2by3, y1 + wby3, dw1by3, dw2by3, 00737 BottomEdge, BorderStyle_Solid, c); 00738 qDrawEdge(p, x1, y2 - wby3, x2, y2, dw1by3, dw2by3, BottomEdge, BorderStyle_Solid, c); 00739 break; 00740 case RightEdge: 00741 qDrawEdge(p, x2 - wby3, y1, x2, y2, dw1by3, dw2by3, RightEdge, BorderStyle_Solid, c); 00742 qDrawEdge(p, x1, y1 + dw1 - dw1by3, x1 + wby3, y2 - dw2 + dw2by3, dw1by3, dw2by3, 00743 RightEdge, BorderStyle_Solid, c); 00744 break; 00745 default: 00746 break; 00747 } 00748 break; 00749 } 00750 case BorderStyle_Ridge: 00751 case BorderStyle_Groove: { 00752 BorderStyle s1, s2; 00753 if (style == BorderStyle_Groove) { 00754 s1 = BorderStyle_Inset; 00755 s2 = BorderStyle_Outset; 00756 } else { 00757 s1 = BorderStyle_Outset; 00758 s2 = BorderStyle_Inset; 00759 } 00760 int dw1by2 = qFloor(dw1/2), dw2by2 = qFloor(dw2/2); 00761 int wby2 = qRound(width/2); 00762 switch (edge) { 00763 case TopEdge: 00764 qDrawEdge(p, x1, y1, x2, y1 + wby2, dw1by2, dw2by2, TopEdge, s1, c); 00765 qDrawEdge(p, x1 + dw1by2, y1 + wby2, x2 - dw2by2, y2, dw1by2, dw2by2, TopEdge, s2, c); 00766 break; 00767 case BottomEdge: 00768 qDrawEdge(p, x1, y1 + wby2, x2, y2, dw1by2, dw2by2, BottomEdge, s1, c); 00769 qDrawEdge(p, x1 + dw1by2, y1, x2 - dw2by2, y1 + wby2, dw1by2, dw2by2, BottomEdge, s2, c); 00770 break; 00771 case LeftEdge: 00772 qDrawEdge(p, x1, y1, x1 + wby2, y2, dw1by2, dw2by2, LeftEdge, s1, c); 00773 qDrawEdge(p, x1 + wby2, y1 + dw1by2, x2, y2 - dw2by2, dw1by2, dw2by2, LeftEdge, s2, c); 00774 break; 00775 case RightEdge: 00776 qDrawEdge(p, x1 + wby2, y1, x2, y2, dw1by2, dw2by2, RightEdge, s1, c); 00777 qDrawEdge(p, x1, y1 + dw1by2, x1 + wby2, y2 - dw2by2, dw1by2, dw2by2, RightEdge, s2, c); 00778 break; 00779 default: 00780 break; 00781 } 00782 } 00783 default: 00784 break; 00785 } 00786 p->restore(); 00787 }
Here is the call graph for this function:

| static void qDrawRoundedCorners | ( | QPainter * | p, | |
| qreal | x1, | |||
| qreal | y1, | |||
| qreal | x2, | |||
| qreal | y2, | |||
| const QSizeF & | r1, | |||
| const QSizeF & | r2, | |||
| Edge | edge, | |||
| BorderStyle | s, | |||
| QColor | c | |||
| ) | [static] |
Definition at line 553 of file qstylesheetstyle.cpp.
References QPainter::Antialiasing, QCss::BorderStyle_Double, QCss::BorderStyle_Groove, QCss::BorderStyle_Inset, QCss::BorderStyle_Outset, QCss::BorderStyle_Ridge, QCss::BorderStyle_Solid, QCss::BottomEdge, c, QSizeF::height(), QSizeF::isEmpty(), QCss::LeftEdge, Qt::NoBrush, p, qPenFromStyle(), qRound(), QCss::RightEdge, s1, s2, QPen::setCapStyle(), Qt::SquareCap, QCss::TopEdge, and QSizeF::width().
Referenced by QRenderRule::drawBorder().
00556 { 00557 const qreal pw = (edge == TopEdge || edge == BottomEdge) ? y2-y1 : x2-x1; 00558 if (s == BorderStyle_Double) { 00559 qreal wby3 = pw/3; 00560 switch (edge) { 00561 case TopEdge: 00562 case BottomEdge: 00563 qDrawRoundedCorners(p, x1, y1, x2, y1+wby3, r1, r2, edge, BorderStyle_Solid, c); 00564 qDrawRoundedCorners(p, x1, y2-wby3, x2, y2, r1, r2, edge, BorderStyle_Solid, c); 00565 break; 00566 case LeftEdge: 00567 qDrawRoundedCorners(p, x1, y1+1, x1+wby3, y2, r1, r2, LeftEdge, BorderStyle_Solid, c); 00568 qDrawRoundedCorners(p, x2-wby3, y1+1, x2, y2, r1, r2, LeftEdge, BorderStyle_Solid, c); 00569 break; 00570 case RightEdge: 00571 qDrawRoundedCorners(p, x1, y1+1, x1+wby3, y2, r1, r2, RightEdge, BorderStyle_Solid, c); 00572 qDrawRoundedCorners(p, x2-wby3, y1+1, x2, y2, r1, r2, RightEdge, BorderStyle_Solid, c); 00573 break; 00574 default: 00575 break; 00576 } 00577 return; 00578 } else if (s == BorderStyle_Ridge || s == BorderStyle_Groove) { 00579 BorderStyle s1, s2; 00580 if (s == BorderStyle_Groove) { 00581 s1 = BorderStyle_Inset; 00582 s2 = BorderStyle_Outset; 00583 } else { 00584 s1 = BorderStyle_Outset; 00585 s2 = BorderStyle_Inset; 00586 } 00587 int pwby2 = qRound(pw/2); 00588 switch (edge) { 00589 case TopEdge: 00590 qDrawRoundedCorners(p, x1, y1, x2, y1 + pwby2, r1, r2, TopEdge, s1, c); 00591 qDrawRoundedCorners(p, x1, y1 + pwby2, x2, y2, r1, r2, TopEdge, s2, c); 00592 break; 00593 case BottomEdge: 00594 qDrawRoundedCorners(p, x1, y1 + pwby2, x2, y2, r1, r2, BottomEdge, s1, c); 00595 qDrawRoundedCorners(p, x1, y1, x2, y2-pwby2, r1, r2, BottomEdge, s2, c); 00596 break; 00597 case LeftEdge: 00598 qDrawRoundedCorners(p, x1, y1, x1 + pwby2, y2, r1, r2, LeftEdge, s1, c); 00599 qDrawRoundedCorners(p, x1 + pwby2, y1, x2, y2, r1, r2, LeftEdge, s2, c); 00600 break; 00601 case RightEdge: 00602 qDrawRoundedCorners(p, x1 + pwby2, y1, x2, y2, r1, r2, RightEdge, s1, c); 00603 qDrawRoundedCorners(p, x1, y1, x2 - pwby2, y2, r1, r2, RightEdge, s2, c); 00604 break; 00605 default: 00606 break; 00607 } 00608 } else if ((s == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge)) 00609 || (s == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge))) 00610 c = c.light(); 00611 00612 p->save(); 00613 p->setRenderHint(QPainter::Antialiasing); 00614 qreal pwby2 = pw/2; 00615 p->setBrush(Qt::NoBrush); 00616 QPen pen = qPenFromStyle(c, pw, s); 00617 pen.setCapStyle(Qt::SquareCap); // this eliminates the offby1 errors that we might hit below 00618 p->setPen(pen); 00619 switch (edge) { 00620 case TopEdge: 00621 if (!r1.isEmpty()) 00622 p->drawArc(QRectF(x1 - r1.width() + pwby2, y1 + pwby2, 00623 2*r1.width() - pw, 2*r1.height() - pw), 135*16, -45*16); 00624 if (!r2.isEmpty()) 00625 p->drawArc(QRectF(x2 - r2.width() + pwby2, y1 + pwby2, 00626 2*r2.width() - pw, 2*r2.height() - pw), 45*16, 45*16); 00627 break; 00628 case BottomEdge: 00629 if (!r1.isEmpty()) 00630 p->drawArc(QRectF(x1 - r1.width() + pwby2, y2 - 2*r1.height() + pwby2, 00631 2*r1.width() - pw, 2*r1.height() - pw), -90 * 16, -45 * 16); 00632 if (!r2.isEmpty()) 00633 p->drawArc(QRectF(x2 - r2.width() + pwby2, y2 - 2*r2.height() + pwby2, 00634 2*r2.width() - pw, 2*r2.height() - pw), -90 * 16, 45 * 16); 00635 break; 00636 case LeftEdge: 00637 if (!r1.isEmpty()) 00638 p->drawArc(QRectF(x1 + pwby2, y1 - r1.height() + pwby2, 00639 2*r1.width() - pw, 2*r1.height() - pw), 135*16, 45*16); 00640 if (!r2.isEmpty()) 00641 p->drawArc(QRectF(x1 + pwby2, y2 - r2.height() + pwby2, 00642 2*r2.width() - pw, 2*r2.height() - pw), 180*16, 45*16); 00643 break; 00644 case RightEdge: 00645 if (!r1.isEmpty()) 00646 p->drawArc(QRectF(x2 - 2*r1.width() + pwby2, y1 - r1.height() + pwby2, 00647 2*r1.width() - pw, 2*r1.height() - pw), 45*16, -45*16); 00648 if (!r2.isEmpty()) 00649 p->drawArc(QRectF(x2 - 2*r2.width() + pwby2, y2 - r2.height() + pwby2, 00650 2*r2.width() - pw, 2*r2.height() - pw), 315*16, 45*16); 00651 break; 00652 default: 00653 break; 00654 } 00655 p->restore(); 00656 }
Here is the call graph for this function:

| static QPen qPenFromStyle | ( | const QBrush & | b, | |
| qreal | width, | |||
| BorderStyle | s | |||
| ) | [static] |
Definition at line 524 of file qstylesheetstyle.cpp.
References b, QCss::BorderStyle_Dashed, QCss::BorderStyle_DotDash, QCss::BorderStyle_DotDotDash, QCss::BorderStyle_Dotted, QCss::BorderStyle_Inset, QCss::BorderStyle_Outset, QCss::BorderStyle_Solid, Qt::DashDotDotLine, Qt::DashDotLine, Qt::DashLine, Qt::DotLine, Qt::FlatCap, Qt::NoPen, and Qt::SolidLine.
Referenced by qDrawEdge(), and qDrawRoundedCorners().
00525 { 00526 Qt::PenStyle ps = Qt::NoPen; 00527 00528 switch (s) { 00529 case BorderStyle_Dotted: 00530 ps = Qt::DotLine; 00531 break; 00532 case BorderStyle_Dashed: 00533 ps = width == 1 ? Qt::DotLine : Qt::DashLine; 00534 break; 00535 case BorderStyle_DotDash: 00536 ps = Qt::DashDotLine; 00537 break; 00538 case BorderStyle_DotDotDash: 00539 ps = Qt::DashDotDotLine; 00540 break; 00541 case BorderStyle_Inset: 00542 case BorderStyle_Outset: 00543 case BorderStyle_Solid: 00544 ps = Qt::SolidLine; 00545 break; 00546 default: 00547 break; 00548 } 00549 00550 return QPen(b, width, ps, Qt::FlatCap); 00551 }
| static QVector<QCss::StyleRule> styleRules | ( | QWidget * | w | ) | [static] |
Definition at line 1221 of file qstylesheetstyle.cpp.
References QList< T >::count(), i, n, QCss::StyleSheet::origin, QList< T >::prepend(), qApp, qWarning(), QCss::StyleSelector::styleRulesForNode(), styleSheetCache, QCss::StyleSheetOrigin_Author, QCss::StyleSheetOrigin_Inline, QCss::StyleSelector::styleSheets, and w.
Referenced by QStyleSheetStyle::hasStyleRule(), QStyleSheetStyle::polish(), and QStyleSheetStyle::renderRule().
01222 { 01223 QStyleSheetStyleSelector styleSelector; 01224 if (!qApp->styleSheet().isEmpty()) { 01225 StyleSheet appSs; 01226 if (!styleSheetCache->contains(0)) { 01227 Parser parser1(qApp->styleSheet()); 01228 if (!parser1.parse(&appSs)) 01229 qWarning("Could not parse application stylesheet"); 01230 appSs.origin = StyleSheetOrigin_Author; 01231 styleSheetCache->insert(0, appSs); 01232 } else { 01233 appSs = styleSheetCache->value(0); 01234 } 01235 styleSelector.styleSheets += appSs; 01236 } 01237 01238 QList<QCss::StyleSheet> widgetSs; 01239 for (QWidget *wid = w; wid; wid = wid->parentWidget()) { 01240 if (wid->styleSheet().isEmpty()) 01241 continue; 01242 StyleSheet ss; 01243 if (!styleSheetCache->contains(wid)) { 01244 Parser parser(wid->styleSheet()); 01245 if (!parser.parse(&ss) && wid == w) { 01246 Parser parser2(QLatin1String("* {") + wid->styleSheet() + QLatin1String("}")); 01247 if (!parser2.parse(&ss)) 01248 qWarning("Could not parse stylesheet of widget %p", wid); 01249 } 01250 ss.origin = StyleSheetOrigin_Inline; 01251 styleSheetCache->insert(wid, ss); 01252 } else { 01253 ss = styleSheetCache->value(wid); 01254 } 01255 widgetSs.prepend(ss); 01256 } 01257 01258 for (int i = 0; i < widgetSs.count(); i++) 01259 widgetSs[i].depth = i + 1; 01260 01261 styleSelector.styleSheets += widgetSs; 01262 01263 StyleSelector::NodePtr n; 01264 n.ptr = w; 01265 return styleSelector.styleRulesForNode(n); 01266 }
Here is the call graph for this function:

| static void unsetPalette | ( | QWidget * | w | ) | [static] |
Definition at line 1603 of file qstylesheetstyle.cpp.
References customFontWidgets, customPaletteWidgets, QApplication::font(), p, QApplication::palette(), QFont::resolve(), and w.
Referenced by QStyleSheetStyle::polish(), and QStyleSheetStyle::unpolish().
01604 { 01605 if (customPaletteWidgets->contains(w)) { 01606 QPalette p = QApplication::palette(w); 01607 p.resolve(customPaletteWidgets->value(w)); 01608 p.resolve(w->palette()); 01609 w->setPalette(p); 01610 customPaletteWidgets->remove(w); 01611 } 01612 if (customFontWidgets->contains(w)) { 01613 QFont f = QApplication::font(); 01614 f.resolve(customFontWidgets->value(w)); 01615 f.resolve(w->font()); 01616 w->setFont(f); 01617 customFontWidgets->remove(w); 01618 } 01619 }
Here is the call graph for this function:

| static bool unstylable | ( | QWidget * | w | ) | [static] |
Definition at line 1664 of file qstylesheetstyle.cpp.
References Qt::Desktop, and w.
Referenced by QStyleSheetStyle::polish().
01665 { 01666 if (w->windowType() == Qt::Desktop) 01667 return true; 01668 01669 #ifndef QT_NO_SCROLLAREA 01670 if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w->parentWidget())) { 01671 if (sa->viewport() == w) 01672 return true; 01673 } else 01674 #endif 01675 #ifndef QT_NO_LINEEDIT 01676 if (qobject_cast<QLineEdit *>(w)) { 01677 if (0 01678 #ifndef QT_NO_COMBOBOX 01679 || qobject_cast<QComboBox *>(w->parentWidget()) 01680 #endif 01681 #ifndef QT_NO_SPINBOX 01682 || qobject_cast<QAbstractSpinBox *>(w->parentWidget()) 01683 #endif 01684 ) 01685 return true; 01686 } 01687 #endif 01688 return false; 01689 }
| static void updateWidget | ( | QWidget * | widget | ) | [static] |
Definition at line 1621 of file qstylesheetstyle.cpp.
References QCoreApplication::sendEvent(), QEvent::StyleChange, QWidget::update(), and QWidget::updateGeometry().
Referenced by QStyleSheetStyle::polish().
01622 { 01623 QEvent e(QEvent::StyleChange); 01624 QApplication::sendEvent(widget, &e); 01625 widget->update(); 01626 widget->updateGeometry(); 01627 }
Here is the call graph for this function:

Definition at line 1629 of file qstylesheetstyle.cpp.
References QList< T >::at(), i, renderRulesCache, QList< T >::size(), and styleRulesCache.
Referenced by QStyleSheetStyle::repolish().
01630 { 01631 for (int i = 0; i < widgets.size(); ++i) { 01632 QWidget *widget = const_cast<QWidget *>(widgets.at(i)); 01633 Q_ASSERT(widget); 01634 styleRulesCache->remove(widget); 01635 renderRulesCache->remove(widget); 01636 widget->style()->polish(widget); 01637 } 01638 }
Here is the call graph for this function:

QHash<const QWidget *, int>* customFontWidgets = 0 [static] |
Definition at line 52 of file qstylesheetstyle.cpp.
Referenced by initStatics(), QStyleSheetStyle::setPalette(), and unsetPalette().
QHash<const QWidget *, int>* customPaletteWidgets = 0 [static] |
Definition at line 51 of file qstylesheetstyle.cpp.
Referenced by initStatics(), QStyleSheetStyle::setPalette(), unsetPalette(), and QStyleSheetStyle::widgetDestroyed().
const char** endKnownStyleHints = knownStyleHints + sizeof(knownStyleHints)/sizeof(char *) [static] |
struct PseudoElementInfo knownPseudoElements[NumPseudoElements] [static] |
Referenced by QStyleSheetStyle::hasStyleRule(), and QStyleSheetStyle::renderRule().
const char* knownStyleHints[] [static] |
Initial value:
{
"activate-on-singleclick",
"button-layout",
"combobox-list-mousetracking",
"combobox-popup",
"dither-disable-text",
"etch-disabled-text",
"gridline-color",
"lineedit-password-character",
"menubar-altkey-navigation",
"menubar-separator",
"messagebox-text-interaction-flags",
"mouse-tracking",
"opacity",
"show-decoration-selected",
"spinbox-click-autorepeat-rate",
"spincontrol-disable-on-bounds"
}
Definition at line 263 of file qstylesheetstyle.cpp.
Referenced by QRenderRule::QRenderRule().
QHash<const QWidget *, QRenderRules>* renderRulesCache = 0 [static] |
Definition at line 50 of file qstylesheetstyle.cpp.
Referenced by initStatics(), QStyleSheetStyle::polish(), QStyleSheetStyle::unpolish(), updateWidgets(), and QStyleSheetStyle::widgetDestroyed().
QHash<const QWidget *, QVector<StyleRule> >* styleRulesCache = 0 [static] |
Definition at line 48 of file qstylesheetstyle.cpp.
Referenced by QStyleSheetStyle::hasStyleRule(), initStatics(), QStyleSheetStyle::polish(), QStyleSheetStyle::renderRule(), QStyleSheetStyle::repolish(), QStyleSheetStyle::unpolish(), updateWidgets(), and QStyleSheetStyle::widgetDestroyed().
QHash<const QWidget *, StyleSheet>* styleSheetCache = 0 [static] |
Definition at line 53 of file qstylesheetstyle.cpp.
Referenced by initStatics(), QStyleSheetStyle::repolish(), styleRules(), and QStyleSheetStyle::unpolish().
1.5.1