#include "qplastiquestyle.h"
#include "qwindowsstyle_p.h"
#include <qapplication.h>
#include <qbitmap.h>
#include <qabstractitemview.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qdatetime.h>
#include <qdebug.h>
#include <qdialogbuttonbox.h>
#include <qgroupbox.h>
#include <qimage.h>
#include <qlineedit.h>
#include <qmainwindow.h>
#include <qmenu.h>
#include <qmenubar.h>
#include <qpainter.h>
#include <qpaintengine.h>
#include <qpainterpath.h>
#include <qpalette.h>
#include <qpen.h>
#include <qpixmap.h>
#include <qpixmapcache.h>
#include <qprogressbar.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qscrollbar.h>
#include <qspinbox.h>
#include <qsplitter.h>
#include <qstyleoption.h>
#include <qtextedit.h>
#include <qtoolbar.h>
#include <qtoolbox.h>
#include <qtoolbutton.h>
#include <qworkspace.h>
#include <qprocess.h>
#include <qfileinfo.h>
#include <qsettings.h>
#include <qdir.h>
#include <limits.h>
Include dependency graph for qplastiquestyle.cpp:
Go to the source code of this file.
Classes | |
class | QPlastiqueStylePrivate |
Defines | |
#define | BEGIN_PLASTIQUE_PIXMAPCACHE(a) |
#define | END_PLASTIQUE_PIXMAPCACHE |
Functions | |
static QLinearGradient | qMapGradientToRect (const QLinearGradient &gradient, const QRectF &rect) |
static QBrush | qMapBrushToRect (const QBrush &brush, const QRectF &rect) |
static void | qBrushSetAlphaF (QBrush *brush, qreal alpha) |
static QBrush | qBrushLight (QBrush brush, int light) |
static QBrush | qBrushDark (QBrush brush, int dark) |
static void | qt_plastique_draw_frame (QPainter *painter, const QRect &rect, const QStyleOption *option, QFrame::Shadow shadow=QFrame::Plain) |
static QColor | mergedColors (const QColor &colorA, const QColor &colorB, int factor=50) |
static QString | uniqueName (const QString &key, const QStyleOption *option, const QSize &size) |
static void | qt_plastique_draw_gradient (QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop) |
static void | qt_plastique_drawFrame (QPainter *painter, const QStyleOption *option, const QWidget *widget) |
static void | qt_plastique_drawShadedPanel (QPainter *painter, const QStyleOption *option, bool base, const QWidget *widget) |
static void | qt_plastique_draw_mdibutton (QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken) |
static QString | elliditide (const QString &text, const QFontMetrics &fontMetrics, const QRect &rect, int *textWidth=0) |
static void | qt_plastique_draw_handle (QPainter *painter, const QStyleOption *option, const QRect &rect, Qt::Orientation orientation, const QWidget *widget) |
static QString | kdeHome () |
Variables | |
static bool | UsePixmapCache = true |
static const bool | AnimateBusyProgressBar = true |
static const bool | AnimateProgressBar = false |
static const int | ProgressBarFps = 25 |
static const int | windowsItemFrame = 2 |
static const int | windowsSepHeight = 2 |
static const int | windowsItemHMargin = 3 |
static const int | windowsItemVMargin = 2 |
static const int | windowsArrowHMargin = 6 |
static const int | windowsTabSpacing = 12 |
static const int | windowsCheckMarkHMargin = 2 |
static const int | windowsRightBorder = 15 |
static const int | windowsCheckMarkWidth = 12 |
static const char *const | qt_plastique_slider_verticalhandle [] |
static const char *const | qt_plastique_slider_verticalhandle_left [] |
static const char *const | qt_plastique_slider_horizontalhandle [] |
static const char *const | qt_plastique_slider_horizontalhandle_up [] |
static const char *const | qt_scrollbar_button_arrow_left [] |
static const char *const | qt_scrollbar_button_arrow_right [] |
static const char *const | qt_scrollbar_button_arrow_up [] |
static const char *const | qt_scrollbar_button_arrow_down [] |
static const char *const | qt_scrollbar_button_left [] |
static const char *const | qt_scrollbar_button_right [] |
static const char *const | qt_scrollbar_button_up [] |
static const char *const | qt_scrollbar_button_down [] |
static const char *const | qt_scrollbar_slider_pattern_vertical [] |
static const char *const | qt_scrollbar_slider_pattern_horizontal [] |
static const char *const | qt_toolbarhandle [] |
static const char *const | qt_simple_toolbarhandle [] |
static const char *const | qt_titlebar_context_help [] |
#define BEGIN_PLASTIQUE_PIXMAPCACHE | ( | a | ) |
Value:
QRect rect = button->rect; \ QPixmap cache; \ QPainter *p = painter; \ QString unique = uniqueName((a), option, option->rect.size()); \ if (UsePixmapCache) { \ if (!QPixmapCache::find(unique, cache)) { \ rect.setRect(0, 0, option->rect.width(), option->rect.height()); \ cache = QPixmap(option->rect.size()); \ cache.fill(Qt::transparent); \ p = new QPainter(&cache); \ } else { \ painter->drawPixmap(button->rect.topLeft(), cache); \ break; \ } \ }
Definition at line 405 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawPrimitive().
#define END_PLASTIQUE_PIXMAPCACHE |
Value:
if (p != painter) { \ p->end(); \ delete p; \ painter->drawPixmap(option->rect.topLeft(), cache); \ QPixmapCache::insert(unique, cache); \ }
Definition at line 422 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawPrimitive().
static QString elliditide | ( | const QString & | text, | |
const QFontMetrics & | fontMetrics, | |||
const QRect & | rect, | |||
int * | textWidth = 0 | |||
) | [static] |
Definition at line 875 of file qplastiquestyle.cpp.
References QString::chop(), QString::isEmpty(), QString::left(), QString::mid(), QString::remove(), QString::size(), QRect::width(), QFontMetrics::width(), and width.
Referenced by QPlastiqueStyle::drawControl().
00876 { 00877 // Chop and insert ellide into title if text is too wide 00878 QString title = text; 00879 int width = textWidth ? *textWidth : fontMetrics.width(text); 00880 QString ellipsis = QLatin1String("..."); 00881 if (width > rect.width()) { 00882 QString leftHalf = title.left(title.size() / 2); 00883 QString rightHalf = title.mid(leftHalf.size() + 1); 00884 while (!leftHalf.isEmpty() && !rightHalf.isEmpty()) { 00885 leftHalf.chop(1); 00886 int width = fontMetrics.width(leftHalf + ellipsis + rightHalf); 00887 if (width < rect.width()) { 00888 title = leftHalf + ellipsis + rightHalf; 00889 width = width; 00890 break; 00891 } 00892 rightHalf.remove(0, 1); 00893 width = fontMetrics.width(leftHalf + ellipsis + rightHalf); 00894 if (width < rect.width()) { 00895 title = leftHalf + ellipsis + rightHalf; 00896 width = width; 00897 break; 00898 } 00899 } 00900 } 00901 if (textWidth) 00902 *textWidth = width; 00903 return title; 00904 }
Here is the call graph for this function:
static QString kdeHome | ( | ) | [static] |
Definition at line 5472 of file qplastiquestyle.cpp.
References QDir::homePath(), QString::isEmpty(), and qgetenv().
Referenced by QPlastiqueStylePrivate::lookupIconTheme(), and QPlastiqueStyle::polish().
05473 { 05474 QString home = qgetenv("KDEHOME"); 05475 if (home.isEmpty()) 05476 home = QDir::homePath() + QLatin1String("/.kde"); 05477 return home; 05478 }
Here is the call graph for this function:
static QColor mergedColors | ( | const QColor & | colorA, | |
const QColor & | colorB, | |||
int | factor = 50 | |||
) | [static] |
Definition at line 712 of file qplastiquestyle.cpp.
References QColor::blue, QColor::green, QColor::red, QColor::setBlue(), QColor::setGreen(), and QColor::setRed().
00713 { 00714 const int maxFactor = 100; 00715 QColor tmp = colorA; 00716 tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor); 00717 tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor); 00718 tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor); 00719 return tmp; 00720 }
Here is the call graph for this function:
Definition at line 571 of file qplastiquestyle.cpp.
References QBrush::color(), QGradient::ConicalGradient, QColor::dark(), QPixmapCache::find(), QPixmap::fromImage(), QBrush::gradient(), image, QPixmapCache::insert(), QPixmap::isNull(), QGradient::LinearGradient, name, QColor::QRgb(), qWarning(), QGradient::RadialGradient, rgb, QColor::rgba(), QPixmap::serialNumber(), QBrush::setColor(), QColor::setRgb(), QGradient::setStops(), QBrush::setTexture(), QBrush::texture(), and UsePixmapCache.
Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), and qt_plastique_draw_frame().
00572 { 00573 if (const QGradient *gradient = brush.gradient()) { 00574 // Use the gradient. Call QColor::dark() on all color stops. 00575 QGradientStops stops = gradient->stops(); 00576 QMutableVectorIterator<QGradientStop> it(stops); 00577 while (it.hasNext()) { 00578 it.next(); 00579 it.setValue(QPair<qreal, QColor>(it.value().first, it.value().second.dark(dark))); 00580 } 00581 00582 switch (gradient->type()) { 00583 case QGradient::RadialGradient: { 00584 QRadialGradient grad = *static_cast<const QRadialGradient *>(gradient); 00585 grad.setStops(stops); 00586 brush = QBrush(grad); 00587 break; 00588 } 00589 case QGradient::ConicalGradient: { 00590 QConicalGradient grad = *static_cast<const QConicalGradient *>(gradient); 00591 grad.setStops(stops); 00592 brush = QBrush(grad); 00593 break; 00594 } 00595 default: 00596 qWarning("QPlastiqueStyle::qBrushDark() - unknown gradient type" 00597 " - falling back to QLinearGradient"); 00598 case QGradient::LinearGradient: { 00599 QLinearGradient grad = *static_cast<const QLinearGradient *>(gradient); 00600 grad.setStops(stops); 00601 brush = QBrush(grad); 00602 break; 00603 } 00604 } 00605 } else if (!brush.texture().isNull()) { 00606 // Modify the texture - ridiculously expensive. 00607 QPixmap texture = brush.texture(); 00608 QPixmap pixmap; 00609 QString name = QString("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().serialNumber()); 00610 if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) { 00611 QImage image = texture.toImage(); 00612 QRgb *rgb = reinterpret_cast<QRgb *>(image.bits()); 00613 int pixels = image.width() * image.height(); 00614 QColor tmpColor; 00615 while (pixels--) { 00616 tmpColor.setRgb(*rgb); 00617 *rgb++ = tmpColor.dark(dark).rgba(); 00618 } 00619 pixmap = QPixmap::fromImage(image); 00620 QPixmapCache::insert(name, pixmap); 00621 } 00622 brush.setTexture(pixmap); 00623 } else { 00624 // Use the color 00625 brush.setColor(brush.color().dark(dark)); 00626 } 00627 return brush; 00628 }
Here is the call graph for this function:
Definition at line 512 of file qplastiquestyle.cpp.
References QBrush::color(), QGradient::ConicalGradient, QPixmapCache::find(), QPixmap::fromImage(), QBrush::gradient(), image, QPixmapCache::insert(), QPixmap::isNull(), QColor::light(), QGradient::LinearGradient, name, QColor::QRgb(), qWarning(), QGradient::RadialGradient, rgb, QColor::rgba(), QBrush::setColor(), QColor::setRgb(), QGradient::setStops(), QBrush::setTexture(), QBrush::texture(), and UsePixmapCache.
Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().
00513 { 00514 if (const QGradient *gradient = brush.gradient()) { 00515 // Use the gradient. Call QColor::light() on all color stops. 00516 QGradientStops stops = gradient->stops(); 00517 QMutableVectorIterator<QGradientStop> it(stops); 00518 while (it.hasNext()) { 00519 it.next(); 00520 it.setValue(QPair<qreal, QColor>(it.value().first, it.value().second.light(light))); 00521 } 00522 00523 switch (gradient->type()) { 00524 case QGradient::RadialGradient: { 00525 QRadialGradient grad = *static_cast<const QRadialGradient *>(gradient); 00526 grad.setStops(stops); 00527 brush = QBrush(grad); 00528 break; 00529 } 00530 case QGradient::ConicalGradient: { 00531 QConicalGradient grad = *static_cast<const QConicalGradient *>(gradient); 00532 grad.setStops(stops); 00533 brush = QBrush(grad); 00534 break; 00535 } 00536 default: 00537 qWarning("QPlastiqueStyle::qBrushLight() - unknown gradient type" 00538 " - falling back to QLinearGradient"); 00539 case QGradient::LinearGradient: { 00540 QLinearGradient grad = *static_cast<const QLinearGradient *>(gradient); 00541 grad.setStops(stops); 00542 brush = QBrush(grad); 00543 break; 00544 } 00545 } 00546 } else if (!brush.texture().isNull()) { 00547 // Modify the texture - ridiculously expensive. 00548 QPixmap texture = brush.texture(); 00549 QPixmap pixmap; 00550 QString name = QString("qbrushtexture-light-%1-%2").arg(light).arg(texture.serialNumber()); 00551 if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) { 00552 QImage image = texture.toImage(); 00553 QRgb *rgb = reinterpret_cast<QRgb *>(image.bits()); 00554 int pixels = image.width() * image.height(); 00555 QColor tmpColor; 00556 while (pixels--) { 00557 tmpColor.setRgb(*rgb); 00558 *rgb++ = tmpColor.light(light).rgba(); 00559 } 00560 pixmap = QPixmap::fromImage(image); 00561 QPixmapCache::insert(name, pixmap); 00562 } 00563 brush.setTexture(pixmap); 00564 } else { 00565 // Use the color 00566 brush.setColor(brush.color().light(light)); 00567 } 00568 return brush; 00569 }
Here is the call graph for this function:
static void qBrushSetAlphaF | ( | QBrush * | brush, | |
qreal | alpha | |||
) | [static] |
Definition at line 448 of file qplastiquestyle.cpp.
References QColor::alphaF(), QBrush::color(), QGradient::ConicalGradient, QPixmapCache::find(), QPixmap::fromImage(), QBrush::gradient(), image, QPixmapCache::insert(), QPixmap::isNull(), QGradient::LinearGradient, name, QColor::QRgb(), qWarning(), QGradient::RadialGradient, rgb, QColor::rgba(), QColor::setAlphaF(), QBrush::setColor(), QColor::setRgb(), QGradient::setStops(), QBrush::setTexture(), QBrush::texture(), UsePixmapCache, and QColor::value.
Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), and qt_plastique_draw_frame().
00449 { 00450 if (const QGradient *gradient = brush->gradient()) { 00451 // Use the gradient. Call QColor::setAlphaF() on all color stops. 00452 QGradientStops stops = gradient->stops(); 00453 QMutableVectorIterator<QGradientStop> it(stops); 00454 QColor tmpColor; 00455 while (it.hasNext()) { 00456 it.next(); 00457 tmpColor = it.value().second; 00458 tmpColor.setAlphaF(alpha * tmpColor.alphaF()); 00459 it.setValue(QPair<qreal, QColor>(it.value().first, tmpColor)); 00460 } 00461 00462 switch (gradient->type()) { 00463 case QGradient::RadialGradient: { 00464 QRadialGradient grad = *static_cast<const QRadialGradient *>(gradient); 00465 grad.setStops(stops); 00466 *brush = QBrush(grad); 00467 break; 00468 } 00469 case QGradient::ConicalGradient: { 00470 QConicalGradient grad = *static_cast<const QConicalGradient *>(gradient); 00471 grad.setStops(stops); 00472 *brush = QBrush(grad); 00473 break; 00474 } 00475 default: 00476 qWarning("QPlastiqueStyle::qBrushLight() - unknown gradient type" 00477 " - falling back to QLinearGradient"); 00478 case QGradient::LinearGradient: { 00479 QLinearGradient grad = *static_cast<const QLinearGradient *>(gradient); 00480 grad.setStops(stops); 00481 *brush = QBrush(grad); 00482 break; 00483 } 00484 } 00485 } else if (!brush->texture().isNull()) { 00486 // Modify the texture - ridiculously expensive. 00487 QPixmap texture = brush->texture(); 00488 QPixmap pixmap; 00489 QString name = QString("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.serialNumber()); 00490 if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) { 00491 QImage image = texture.toImage(); 00492 QRgb *rgb = reinterpret_cast<QRgb *>(image.bits()); 00493 int pixels = image.width() * image.height(); 00494 QColor tmpColor; 00495 while (pixels--) { 00496 tmpColor.setRgb(*rgb); 00497 tmpColor.setAlphaF(alpha * tmpColor.alphaF()); 00498 *rgb++ = tmpColor.rgba(); 00499 } 00500 pixmap = QPixmap::fromImage(image); 00501 QPixmapCache::insert(name, pixmap); 00502 } 00503 brush->setTexture(pixmap); 00504 } else { 00505 // Use the color 00506 QColor tmpColor = brush->color(); 00507 tmpColor.setAlphaF(alpha * tmpColor.alphaF()); 00508 brush->setColor(tmpColor); 00509 } 00510 }
Here is the call graph for this function:
Definition at line 438 of file qplastiquestyle.cpp.
References QBrush::gradient(), and qMapGradientToRect().
Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().
00439 { 00440 if (!brush.gradient()) 00441 return brush; 00442 00443 // ### Ugly assumption that it's a linear gradient 00444 QBrush tmp(qMapGradientToRect(*static_cast<const QLinearGradient *>(brush.gradient()), rect)); 00445 return tmp; 00446 }
Here is the call graph for this function:
static QLinearGradient qMapGradientToRect | ( | const QLinearGradient & | gradient, | |
const QRectF & | rect | |||
) | [static] |
Definition at line 430 of file qplastiquestyle.cpp.
References QRectF::bottom(), QRectF::center(), QGradient::setStops(), QGradient::stops(), QRectF::top(), and QPointF::x().
Referenced by qMapBrushToRect().
00431 { 00432 QLinearGradient tmpGrad(rect.center().x(), rect.top(), 00433 rect.center().x(), rect.bottom()); 00434 tmpGrad.setStops(gradient.stops()); 00435 return tmpGrad; 00436 }
Here is the call graph for this function:
static void qt_plastique_draw_frame | ( | QPainter * | painter, | |
const QRect & | rect, | |||
const QStyleOption * | option, | |||
QFrame::Shadow | shadow = QFrame::Plain | |||
) | [static] |
Definition at line 642 of file qplastiquestyle.cpp.
References QRect::bottom(), QPainter::drawLine(), QPainter::drawPoint(), QPalette::highlight(), QRect::left(), QStyleOption::palette, QPainter::pen(), QFrame::Plain, qBrushDark(), qBrushSetAlphaF(), QRect::right(), QPainter::setPen(), QPalette::shadow(), QStyleOption::state, QStyle::State_HasFocus, QFrame::Sunken, and QRect::top().
Referenced by QPlastiqueStyle::drawPrimitive().
00644 { 00645 QPen oldPen = painter->pen(); 00646 QBrush border; 00647 QBrush corner; 00648 QBrush innerTopLeft; 00649 QBrush innerBottomRight; 00650 00651 if (shadow != QFrame::Plain && (option->state & QStyle::State_HasFocus)) { 00652 border = option->palette.highlight(); 00653 qBrushSetAlphaF(&border, 0.8); 00654 corner = option->palette.highlight(); 00655 qBrushSetAlphaF(&corner, 0.5); 00656 innerTopLeft = qBrushDark(option->palette.highlight(), 125); 00657 innerBottomRight = option->palette.highlight(); 00658 qBrushSetAlphaF(&innerBottomRight, 0.65); 00659 } else { 00660 border = option->palette.shadow(); 00661 qBrushSetAlphaF(&border, 0.4); 00662 corner = option->palette.shadow(); 00663 qBrushSetAlphaF(&corner, 0.25); 00664 innerTopLeft = option->palette.shadow(); 00665 innerBottomRight = option->palette.shadow(); 00666 if (shadow == QFrame::Sunken) { 00667 qBrushSetAlphaF(&innerTopLeft, 0.23); 00668 qBrushSetAlphaF(&innerBottomRight, 0.075); 00669 } else { 00670 qBrushSetAlphaF(&innerTopLeft, 0.075); 00671 qBrushSetAlphaF(&innerBottomRight, 0.23); 00672 } 00673 } 00674 00675 // Opaque corner lines 00676 painter->setPen(QPen(border, 0)); 00677 painter->drawLine(rect.left() + 2, rect.top(), rect.right() - 2, rect.top()); 00678 painter->drawLine(rect.left() + 2, rect.bottom(), rect.right() - 2, rect.bottom()); 00679 painter->drawLine(rect.left(), rect.top() + 2, rect.left(), rect.bottom() - 2); 00680 painter->drawLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 2); 00681 00682 // Opaque corner dots 00683 painter->drawPoint(rect.left() + 1, rect.top() + 1); 00684 painter->drawPoint(rect.left() + 1, rect.bottom() - 1); 00685 painter->drawPoint(rect.right() - 1, rect.top() + 1); 00686 painter->drawPoint(rect.right() - 1, rect.bottom() - 1); 00687 00688 // Shaded corner dots 00689 painter->setPen(QPen(corner, 0)); 00690 painter->drawPoint(rect.left(), rect.top() + 1); 00691 painter->drawPoint(rect.left(), rect.bottom() - 1); 00692 painter->drawPoint(rect.left() + 1, rect.top()); 00693 painter->drawPoint(rect.left() + 1, rect.bottom()); 00694 painter->drawPoint(rect.right(), rect.top() + 1); 00695 painter->drawPoint(rect.right(), rect.bottom() - 1); 00696 painter->drawPoint(rect.right() - 1, rect.top()); 00697 painter->drawPoint(rect.right() - 1, rect.bottom()); 00698 00699 // Shadows 00700 if (shadow != QFrame::Plain) { 00701 painter->setPen(QPen(innerTopLeft, 0)); 00702 painter->drawLine(rect.left() + 2, rect.top() + 1, rect.right() - 2, rect.top() + 1); 00703 painter->drawLine(rect.left() + 1, rect.top() + 2, rect.left() + 1, rect.bottom() - 2); 00704 painter->setPen(QPen(innerBottomRight, 0)); 00705 painter->drawLine(rect.left() + 2, rect.bottom() - 1, rect.right() - 2, rect.bottom() - 1); 00706 painter->drawLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2); 00707 } 00708 00709 painter->setPen(oldPen); 00710 }
Here is the call graph for this function:
static void qt_plastique_draw_gradient | ( | QPainter * | painter, | |
const QRect & | rect, | |||
const QColor & | gradientStart, | |||
const QColor & | gradientStop | |||
) | [static] |
Definition at line 732 of file qplastiquestyle.cpp.
References QPainter::drawPixmap(), QPainter::end(), QPixmap::fill(), QPainter::fillRect(), QPixmapCache::find(), QRect::height(), QPixmapCache::insert(), QColor::rgba(), QRect::size(), QString::sprintf(), UsePixmapCache, Qt::white, QRect::width(), and x.
Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), qt_plastique_draw_mdibutton(), and qt_plastique_drawShadedPanel().
00734 { 00735 QString gradientName; 00736 gradientName.sprintf("%dx%d-%x-%x", rect.width(), rect.height(), gradientStart.rgba(), gradientStop.rgba()); 00737 QPixmap cache; 00738 if (!UsePixmapCache || !QPixmapCache::find(gradientName, cache)) { 00739 cache = QPixmap(rect.size()); 00740 cache.fill(Qt::white); 00741 QPainter cachePainter(&cache); 00742 QRect pixmapRect(0, 0, rect.width(), rect.height()); 00743 int x = pixmapRect.center().x(); 00744 QLinearGradient gradient(x, pixmapRect.top(), x, pixmapRect.bottom()); 00745 gradient.setColorAt(0, gradientStart); 00746 gradient.setColorAt(1, gradientStop); 00747 cachePainter.fillRect(pixmapRect, gradient); 00748 cachePainter.end(); 00749 if (UsePixmapCache) 00750 QPixmapCache::insert(gradientName, cache); 00751 } 00752 painter->drawPixmap(rect, cache); 00753 }
Here is the call graph for this function:
static void qt_plastique_draw_handle | ( | QPainter * | painter, | |
const QStyleOption * | option, | |||
const QRect & | rect, | |||
Qt::Orientation | orientation, | |||
const QWidget * | widget | |||
) | [static] |
Definition at line 908 of file qplastiquestyle.cpp.
References QPalette::background(), QWidget::backgroundRole(), QPalette::base(), QBrush::color(), QPalette::color(), QColor::dark(), QPainter::drawImage(), QRect::height(), i, QRect::left(), mergedColors(), QStyleOption::palette, qt_simple_toolbarhandle, QColor::rgba(), spacing, QRect::top(), Qt::Vertical, and QRect::width().
Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().
00911 { 00912 QColor borderColor = option->palette.background().color().dark(178); 00913 QColor alphaCornerColor; 00914 if (widget) { 00915 // ### backgroundrole/foregroundrole should be part of the style option 00916 alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), borderColor); 00917 } else { 00918 alphaCornerColor = mergedColors(option->palette.background().color(), borderColor); 00919 } 00920 00921 QImage handle(qt_simple_toolbarhandle); 00922 handle.setColor(1, alphaCornerColor.rgba()); 00923 handle.setColor(2, mergedColors(alphaCornerColor, option->palette.base().color()).rgba()); 00924 handle.setColor(3, option->palette.base().color().rgba()); 00925 00926 const int spacing = 2; 00927 00928 if (orientation == Qt::Vertical) { 00929 int nchunks = rect.width() / (handle.width() + spacing); 00930 for (int i = 0; i < nchunks; ++i) 00931 painter->drawImage(QPoint(rect.left() + i * (handle.width() + spacing), rect.top()), handle); 00932 } else { 00933 int nchunks = rect.height() / (handle.height() + spacing); 00934 for (int i = 0; i < nchunks; ++i) 00935 painter->drawImage(QPoint(rect.left(), rect.top() + i * (handle.height() + spacing)), handle); 00936 } 00937 }
Here is the call graph for this function:
static void qt_plastique_draw_mdibutton | ( | QPainter * | painter, | |
const QStyleOptionTitleBar * | option, | |||
const QRect & | tmp, | |||
bool | hover, | |||
bool | sunken | |||
) | [static] |
Definition at line 837 of file qplastiquestyle.cpp.
References QRect::adjusted(), QRect::bottom(), QPainter::drawLine(), QPainter::drawPoint(), QRect::isNull(), QRect::left(), qt_plastique_draw_gradient(), QRect::right(), QPainter::setPen(), QStyle::State_Active, QStyleOptionTitleBar::titleBarState, and QRect::top().
Referenced by QPlastiqueStyle::drawComplexControl().
00838 { 00839 if (tmp.isNull()) 00840 return; 00841 bool active = (option->titleBarState & QStyle::State_Active); 00842 00843 // ### use palette colors instead 00844 QColor mdiButtonGradientStartColor; 00845 QColor mdiButtonGradientStopColor; 00846 if (active) { 00847 mdiButtonGradientStartColor = QColor((hover || sunken) ? 0x7d8bb1 : 0x55689a); 00848 mdiButtonGradientStopColor = QColor((hover || sunken) ? 0x939ebe : 0x7381ab); 00849 } else { 00850 mdiButtonGradientStartColor = QColor((hover || sunken) ? 0x9e9e9e : 0x818181); 00851 mdiButtonGradientStopColor = QColor((hover || sunken) ? 0xababab : 0x929292); 00852 } 00853 00854 qt_plastique_draw_gradient(painter, tmp.adjusted(1, 1, -1, -1), 00855 mdiButtonGradientStartColor, mdiButtonGradientStopColor); 00856 00857 QColor mdiButtonBorderColor; 00858 if (active) { 00859 mdiButtonBorderColor = (hover || sunken) ? QColor(0x627097) : QColor(0x324577); 00860 } else { 00861 mdiButtonBorderColor = (hover || sunken) ? QColor(0x838383) : QColor(0x5e5e5e); 00862 } 00863 painter->setPen(QPen(mdiButtonBorderColor, 1)); 00864 painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()); 00865 painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()); 00866 painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2); 00867 painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2); 00868 painter->drawPoint(tmp.left() + 1, tmp.top() + 1); 00869 painter->drawPoint(tmp.right() - 1, tmp.top() + 1); 00870 painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1); 00871 painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1); 00872 }
Here is the call graph for this function:
static void qt_plastique_drawFrame | ( | QPainter * | painter, | |
const QStyleOption * | option, | |||
const QWidget * | widget | |||
) | [static] |
Definition at line 755 of file qplastiquestyle.cpp.
References QPalette::background(), QWidget::backgroundRole(), QRect::bottom(), QPalette::button(), QBrush::color(), QPalette::color(), QColor::dark(), QPainter::drawLine(), QPainter::drawPoint(), QRect::left(), QColor::light(), mergedColors(), QStyleOption::palette, QPainter::pen(), QStyleOption::rect, QRect::right(), QPainter::setPen(), QStyleOption::state, QStyle::State_On, QStyle::State_Sunken, and QRect::top().
Referenced by qt_plastique_drawShadedPanel().
00756 { 00757 QRect rect = option->rect; 00758 QPen oldPen = painter->pen(); 00759 00760 QColor borderColor = option->palette.background().color().dark(178); 00761 QColor gradientStartColor = option->palette.button().color().light(104); 00762 QColor gradientStopColor = option->palette.button().color().dark(105); 00763 QColor alphaCornerColor; 00764 if (widget) { 00765 // ### backgroundrole/foregroundrole should be part of the style option 00766 alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), borderColor); 00767 } else { 00768 alphaCornerColor = mergedColors(option->palette.background().color(), borderColor); 00769 } 00770 00771 // outline / border 00772 painter->setPen(borderColor); 00773 painter->drawLine(rect.left() + 2, rect.top(), rect.right() - 2, rect.top()); 00774 painter->drawLine(rect.left() + 2, rect.bottom(), rect.right() - 2, rect.bottom()); 00775 painter->drawLine(rect.left(), rect.top() + 2, rect.left(), rect.bottom() - 2); 00776 painter->drawLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 2); 00777 painter->drawPoint(rect.left() + 1, rect.top() + 1); 00778 painter->drawPoint(rect.right() - 1, rect.top() + 1); 00779 painter->drawPoint(rect.left() + 1, rect.bottom() - 1); 00780 painter->drawPoint(rect.right() - 1, rect.bottom() - 1); 00781 00782 painter->setPen(alphaCornerColor); 00783 painter->drawPoint(rect.left() + 1, rect.top()); 00784 painter->drawPoint(rect.right() - 1, rect.top()); 00785 painter->drawPoint(rect.left() + 1, rect.bottom()); 00786 painter->drawPoint(rect.right() - 1, rect.bottom()); 00787 painter->drawPoint(rect.left(), rect.top() + 1); 00788 painter->drawPoint(rect.right(), rect.top() + 1); 00789 painter->drawPoint(rect.left(), rect.bottom() - 1); 00790 painter->drawPoint(rect.right(), rect.bottom() - 1); 00791 00792 // inner border 00793 if ((option->state & QStyle::State_Sunken) || (option->state & QStyle::State_On)) 00794 painter->setPen(option->palette.button().color().dark(118)); 00795 else 00796 painter->setPen(gradientStartColor); 00797 painter->drawLine(rect.left() + 2, rect.top() + 1, rect.right() - 2, option->rect.top() + 1); 00798 painter->drawLine(rect.left() + 1, rect.top() + 2, rect.left() + 1, option->rect.bottom() - 2); 00799 00800 if ((option->state & QStyle::State_Sunken) || (option->state & QStyle::State_On)) 00801 painter->setPen(option->palette.button().color().dark(110)); 00802 else 00803 painter->setPen(gradientStopColor.dark(102)); 00804 painter->drawLine(rect.left() + 2, rect.bottom() - 1, rect.right() - 2, rect.bottom() - 1); 00805 painter->drawLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2); 00806 00807 painter->setPen(oldPen); 00808 }
Here is the call graph for this function:
static void qt_plastique_drawShadedPanel | ( | QPainter * | painter, | |
const QStyleOption * | option, | |||
bool | base, | |||
const QWidget * | widget | |||
) | [static] |
Definition at line 810 of file qplastiquestyle.cpp.
References QRect::adjusted(), QPalette::background(), QPalette::button(), QBrush::color(), QColor::dark(), QColor::light(), QStyleOption::palette, QPainter::pen(), qt_plastique_draw_gradient(), qt_plastique_drawFrame(), QStyleOption::rect, QPainter::setPen(), QStyleOption::state, QStyle::State_AutoRaise, QStyle::State_Enabled, QStyle::State_On, and QStyle::State_Sunken.
Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().
00812 { 00813 QRect rect = option->rect; 00814 QPen oldPen = painter->pen(); 00815 00816 QColor gradientStartColor = option->palette.button().color().light(104); 00817 QColor gradientStopColor = option->palette.button().color().dark(105); 00818 00819 // gradient fill 00820 if ((option->state & QStyle::State_Enabled) || !(option->state & QStyle::State_AutoRaise)) { 00821 if ((option->state & QStyle::State_Sunken) || (option->state & QStyle::State_On)) { 00822 qt_plastique_draw_gradient(painter, rect.adjusted(1, 1, -1, -1), 00823 option->palette.button().color().dark(114), 00824 option->palette.button().color().dark(106)); 00825 } else { 00826 qt_plastique_draw_gradient(painter, rect.adjusted(1, 1, -1, -1), 00827 base ? option->palette.background().color().light(105) : gradientStartColor, 00828 base ? option->palette.background().color().dark(102) : gradientStopColor); 00829 } 00830 } 00831 00832 qt_plastique_drawFrame(painter, option, widget); 00833 00834 painter->setPen(oldPen); 00835 }
Here is the call graph for this function:
static QString uniqueName | ( | const QString & | key, | |
const QStyleOption * | option, | |||
const QSize & | size | |||
) | [static] |
Definition at line 722 of file qplastiquestyle.cpp.
References QStyleOptionComplex::activeSubControls, key, QStyleOption::palette, QPalette::serialNumber(), size, QString::sprintf(), and QStyleOption::state.
00723 { 00724 QString tmp; 00725 const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option); 00726 tmp.sprintf("%s-%d-%d-%d-%dx%d", key.toLatin1().constData(), uint(option->state), 00727 complexOption ? uint(complexOption->activeSubControls) : uint(0), 00728 option->palette.serialNumber(), size.width(), size.height()); 00729 return tmp; 00730 }
Here is the call graph for this function:
const bool AnimateBusyProgressBar = true [static] |
Definition at line 29 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawControl(), QPlastiqueStyle::polish(), and QPlastiqueStyle::unpolish().
const bool AnimateProgressBar = false [static] |
Definition at line 30 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::timerEvent().
const int ProgressBarFps = 25 [static] |
Definition at line 32 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawControl(), QPlastiqueStyle::eventFilter(), and QPlastiqueStyle::timerEvent().
const char* const qt_plastique_slider_horizontalhandle[] [static] |
Initial value:
{ "11 15 4 1", " c None", "+ c #979797", "@ c #C9C9C9", "$ c #C1C1C1", " $+++++++$ ", "$+ +$", "+ +", "+ $$ $$ +", "+ $@ $@ +", "+ +", "+ +", "+ +", "+ +", "+ +", "$+ +$", " $+ +$ ", " $+ +$ ", " $+ +$ ", " $+$ "}
Definition at line 121 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawComplexControl().
const char* const qt_plastique_slider_horizontalhandle_up[] [static] |
Initial value:
{ "11 15 4 1", " c None", "+ c #979797", "@ c #C9C9C9", "$ c #C1C1C1", " $+$ ", " $+ +$ ", " $+ +$ ", " $+ +$ ", "$+ +$", "+ +", "+ +", "+ +", "+ +", "+ +", "+ $$ $$ +", "+ $@ $@ +", "+ +", "$+ +$", " $+++++++$ "}
Definition at line 143 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawComplexControl().
const char* const qt_plastique_slider_verticalhandle[] [static] |
Initial value:
{ "15 11 4 1", " c None", "+ c #979797", "@ c #C9C9C9", "$ c #C1C1C1", " $++++++++$ ", "$+ +$ ", "+ $$ +$ ", "+ $@ +$ ", "+ +$", "+ +", "+ +$", "+ $$ +$ ", "+ $@ +$ ", "$+ +$ ", " $++++++++$ "}
Definition at line 85 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawComplexControl().
const char* const qt_plastique_slider_verticalhandle_left[] [static] |
Initial value:
{ "15 11 4 1", " c None", "+ c #979797", "@ c #C9C9C9", "$ c #C1C1C1", " $++++++++$ ", " $+ +$", " $+ $$ +", " $+ $@ +", "$+ +", "+ +", "$+ +", " $+ $$ +", " $+ $@ +", " $+ +$", " $++++++++$ "}
Definition at line 103 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawComplexControl().
const char* const qt_scrollbar_button_arrow_down[] [static] |
Initial value:
{ "7 4 2 1", " c None", "* c #BFBFBF", "*******", " ***** ", " *** ", " * "}
Definition at line 198 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_arrow_left[] [static] |
Initial value:
{ "4 7 2 1", " c None", "* c #BFBFBF", " *", " **", " ***", "****", " ***", " **", " *"}
Definition at line 165 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_arrow_right[] [static] |
Initial value:
{ "4 7 2 1", " c None", "* c #BFBFBF", "* ", "** ", "*** ", "****", "*** ", "** ", "* "}
Definition at line 177 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_arrow_up[] [static] |
Initial value:
{ "7 4 2 1", " c None", "* c #BFBFBF", " * ", " *** ", " ***** ", "*******"}
Definition at line 189 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_down[] [static] |
Initial value:
{ "16 16 6 1", " c None", ". c #BFBFBF", "+ c #979797", "# c #FAFAFA", "< c #FAFAFA", "* c #FAFAFA", "++++++++++++++++", "+##############+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", ".+<<<<<<<<<<<<+.", " .++++++++++++. "}
Definition at line 282 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_left[] [static] |
Initial value:
{ "16 16 6 1", " c None", ". c #BFBFBF", "+ c #979797", "# c #FAFAFA", "< c #FAFAFA", "* c #FAFAFA", " .+++++++++++++.", ".+#############+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", ".+<<<<<<<<<<<<<+", " .+++++++++++++."}
Definition at line 207 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_right[] [static] |
Initial value:
{ "16 16 6 1", " c None", ". c #BFBFBF", "+ c #979797", "# c #FAFAFA", "< c #FAFAFA", "* c #FAFAFA", ".+++++++++++++. ", "+#############+.", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+<<<<<<<<<<<<<+.", ".+++++++++++++. "}
Definition at line 232 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_button_up[] [static] |
Initial value:
{ "16 16 6 1", " c None", ". c #BFBFBF", "+ c #979797", "# c #FAFAFA", "< c #FAFAFA", "* c #FAFAFA", " .++++++++++++. ", ".+############+.", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+# <+", "+<<<<<<<<<<<<<<+", ".++++++++++++++."}
Definition at line 257 of file qplastiquestyle.cpp.
const char* const qt_scrollbar_slider_pattern_horizontal[] [static] |
Initial value:
{ "18 10 3 1", " c None", ". c #BFBFBF", "+ c #979797", ".. .. .. .. ..", ".+ .+ .+ .+ .+", " ", " ", ".. .. .. .. ..", ".+ .+ .+ .+ .+", " ", " ", ".. .. .. .. ..", ".+ .+ .+ .+ .+"}
Definition at line 331 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawControl().
const char* const qt_scrollbar_slider_pattern_vertical[] [static] |
Initial value:
{ "10 18 3 1", " c None", ". c #BFBFBF", "+ c #979797", ".. .. ..", ".+ .+ .+", " ", " ", ".. .. ..", ".+ .+ .+", " ", " ", ".. .. ..", ".+ .+ .+", " ", " ", ".. .. ..", ".+ .+ .+", " ", " ", ".. .. ..", ".+ .+ .+"}
Definition at line 307 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawControl().
const char* const qt_simple_toolbarhandle[] [static] |
Initial value:
{ "3 3 4 1", " c None", ". c #C5C5C5", "+ c #EEEEEE", "@ c #FAFAFA", ".. ", ".+@", " @@"}
Definition at line 360 of file qplastiquestyle.cpp.
Referenced by qt_plastique_draw_handle().
const char* const qt_titlebar_context_help[] [static] |
Definition at line 370 of file qplastiquestyle.cpp.
const char* const qt_toolbarhandle[] [static] |
Initial value:
{ "6 6 4 1", " c None", ". c #C5C5C5", "+ c #EEEEEE", "@ c #FAFAFA", ".. ", ".+@ ", " @@ ", " .. ", " .+@", " @@"}
Definition at line 347 of file qplastiquestyle.cpp.
Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().
bool UsePixmapCache = true [static] |
Definition at line 28 of file qplastiquestyle.cpp.
const int windowsArrowHMargin = 6 [static] |
Definition at line 79 of file qplastiquestyle.cpp.
const int windowsCheckMarkHMargin = 2 [static] |
Definition at line 81 of file qplastiquestyle.cpp.
const int windowsCheckMarkWidth = 12 [static] |
Definition at line 83 of file qplastiquestyle.cpp.
const int windowsItemFrame = 2 [static] |
Definition at line 75 of file qplastiquestyle.cpp.
const int windowsItemHMargin = 3 [static] |
Definition at line 77 of file qplastiquestyle.cpp.
const int windowsItemVMargin = 2 [static] |
Definition at line 78 of file qplastiquestyle.cpp.
const int windowsRightBorder = 15 [static] |
Definition at line 82 of file qplastiquestyle.cpp.
const int windowsSepHeight = 2 [static] |
Definition at line 76 of file qplastiquestyle.cpp.
const int windowsTabSpacing = 12 [static] |
Definition at line 80 of file qplastiquestyle.cpp.