Qt 4.8
Classes | Macros | Functions | Variables
qplastiquestyle.cpp File Reference
#include "qplastiquestyle.h"
#include "qwindowsstyle_p.h"
#include <qapplication.h>
#include <qbitmap.h>
#include <qabstractitemview.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qdebug.h>
#include <qdialogbuttonbox.h>
#include <qformlayout.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 <qelapsedtimer.h>
#include <qtoolbar.h>
#include <qtoolbox.h>
#include <qtoolbutton.h>
#include <qworkspace.h>
#include <qprocess.h>
#include <qvarlengtharray.h>
#include <limits.h>
#include <private/qstylehelper_p.h>

Go to the source code of this file.

Classes

class  QPlastiqueStylePrivate
 

Macros

#define CT1(c)   CT2(c, c)
 
#define CT2(c1, c2)   (((uint)c1 << 16) | (uint)c2)
 

Functions

static QString elliditide (const QString &text, const QFontMetrics &fontMetrics, const QRect &rect, int *textWidth=0)
 
static QColor mergedColors (const QColor &colorA, const QColor &colorB, int factor=50)
 
static QBrush qBrushDark (QBrush brush, int dark)
 
static QBrush qBrushLight (QBrush brush, int light)
 
static void qBrushSetAlphaF (QBrush *brush, qreal alpha)
 
static QBrush qMapBrushToRect (const QBrush &brush, const QRectF &rect)
 
static QLinearGradient qMapGradientToRect (const QLinearGradient &gradient, const QRectF &rect)
 
static void qt_plastique_draw_frame (QPainter *painter, const QRect &rect, const QStyleOption *option, QFrame::Shadow shadow=QFrame::Plain)
 
static void qt_plastique_draw_gradient (QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop)
 
static void qt_plastique_draw_handle (QPainter *painter, const QStyleOption *option, const QRect &rect, Qt::Orientation orientation, const QWidget *widget)
 
static void qt_plastique_draw_mdibutton (QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken)
 
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)
 

Variables

static const bool AnimateBusyProgressBar = true
 
static const bool AnimateProgressBar = false
 
static const int blueFrameWidth = 2
 
static const int ProgressBarFps = 25
 
static const char *const qt_plastique_slider_horizontalhandle []
 
static const char *const qt_plastique_slider_horizontalhandle_up []
 
static const char *const qt_plastique_slider_verticalhandle []
 
static const char *const qt_plastique_slider_verticalhandle_left []
 
static const char *const qt_scrollbar_button_arrow_down []
 
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_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_slider_pattern_horizontal []
 
static const char *const qt_scrollbar_slider_pattern_vertical []
 
static const char *const qt_simple_toolbarhandle []
 
static const char *const qt_titlebar_context_help []
 
static const char *const qt_toolbarhandle []
 
static const int windowsArrowHMargin = 6
 
static const int windowsCheckMarkWidth = 12
 
static const int windowsItemFrame = 2
 
static const int windowsItemHMargin = 3
 
static const int windowsItemVMargin = 2
 
static const int windowsRightBorder = 15
 
static const int windowsSepHeight = 2
 
static const int windowsTabSpacing = 12
 

Macro Definition Documentation

◆ CT1

#define CT1 (   c)    CT2(c, c)

Definition at line 5867 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::layoutSpacingImplementation().

◆ CT2

#define CT2 (   c1,
  c2 
)    (((uint)c1 << 16) | (uint)c2)

Definition at line 5868 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::layoutSpacingImplementation().

Function Documentation

◆ elliditide()

static QString elliditide ( const QString text,
const QFontMetrics fontMetrics,
const QRect rect,
int *  textWidth = 0 
)
static

Definition at line 918 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

919 {
920  // Chop and insert ellide into title if text is too wide
921  QString title = text;
922  int width = textWidth ? *textWidth : fontMetrics.width(text);
923  QString ellipsis = QLatin1String("...");
924  if (width > rect.width()) {
925  QString leftHalf = title.left(title.size() / 2);
926  QString rightHalf = title.mid(leftHalf.size() + 1);
927  while (!leftHalf.isEmpty() && !rightHalf.isEmpty()) {
928  leftHalf.chop(1);
929  int width = fontMetrics.width(leftHalf + ellipsis + rightHalf);
930  if (width < rect.width()) {
931  title = leftHalf + ellipsis + rightHalf;
932  width = width;
933  break;
934  }
935  rightHalf.remove(0, 1);
936  width = fontMetrics.width(leftHalf + ellipsis + rightHalf);
937  if (width < rect.width()) {
938  title = leftHalf + ellipsis + rightHalf;
939  width = width;
940  break;
941  }
942  }
943  }
944  if (textWidth)
945  *textWidth = width;
946  return title;
947 }
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
void chop(int n)
Removes n characters from the end of the string.
Definition: qstring.cpp:4623
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
#define text
Definition: qobjectdefs.h:80

◆ mergedColors()

static QColor mergedColors ( const QColor colorA,
const QColor colorB,
int  factor = 50 
)
static

Definition at line 730 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), qt_plastique_draw_handle(), and qt_plastique_drawFrame().

731 {
732  const int maxFactor = 100;
733  QColor tmp = colorA;
734  tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor);
735  tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor);
736  tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor);
737  return tmp;
738 }
void setRed(int red)
Sets the red color component of this color to red.
Definition: qcolor.cpp:1143
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setGreen(int green)
Sets the green color component of this color to green.
Definition: qcolor.cpp:1170
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
void setBlue(int blue)
Sets the blue color component of this color to blue.
Definition: qcolor.cpp:1199
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244

◆ qBrushDark()

static QBrush qBrushDark ( QBrush  brush,
int  dark 
)
static

Definition at line 578 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), and qt_plastique_draw_frame().

579 {
580  if (const QGradient *gradient = brush.gradient()) {
581  // Use the gradient. Call QColor::darker() on all color stops.
582  QGradientStops stops = gradient->stops();
583  QMutableVectorIterator<QGradientStop> it(stops);
584  while (it.hasNext()) {
585  it.next();
586  it.setValue(QPair<qreal, QColor>(it.value().first, it.value().second.darker(dark)));
587  }
588 
589  switch (gradient->type()) {
591  QRadialGradient grad = *static_cast<const QRadialGradient *>(gradient);
592  grad.setStops(stops);
593  brush = QBrush(grad);
594  break;
595  }
597  QConicalGradient grad = *static_cast<const QConicalGradient *>(gradient);
598  grad.setStops(stops);
599  brush = QBrush(grad);
600  break;
601  }
602  default:
603  qWarning("QPlastiqueStyle::qBrushDark() - unknown gradient type"
604  " - falling back to QLinearGradient");
606  QLinearGradient grad = *static_cast<const QLinearGradient *>(gradient);
607  grad.setStops(stops);
608  brush = QBrush(grad);
609  break;
610  }
611  }
612  } else if (!brush.texture().isNull()) {
613  // Modify the texture - ridiculously expensive.
614  QPixmap texture = brush.texture();
615  QPixmap pixmap;
616  QString name = QLatin1Literal("qbrushtexture-dark")
617  % HexString<int>(dark)
618  % HexString<qint64>(texture.cacheKey());
619 
620  if (!QPixmapCache::find(name, pixmap)) {
621  QImage image = texture.toImage();
622  QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
623  int pixels = image.width() * image.height();
624  QColor tmpColor;
625  while (pixels--) {
626  tmpColor.setRgb(*rgb);
627  *rgb++ = tmpColor.darker(dark).rgba();
628  }
629  pixmap = QPixmap::fromImage(image);
630  QPixmapCache::insert(name, pixmap);
631  }
632  brush.setTexture(pixmap);
633  } else {
634  // Use the color
635  brush.setColor(brush.color().darker(dark));
636  }
637  return brush;
638 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setRgb(int r, int g, int b, int a=255)
Sets the RGB value to r, g, b and the alpha value to a.
Definition: qcolor.cpp:980
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
unsigned int QRgb
Definition: qrgb.h:53
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
#define it(className, varName)
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
Definition: qbrush.h:329
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
Definition: qbrush.h:297
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QPixmap * find(const QString &key)
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
void setColor(const QColor &color)
Sets the brush color to the given color.
Definition: qbrush.cpp:725
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
void setTexture(const QPixmap &pixmap)
Sets the brush pixmap to pixmap.
Definition: qbrush.cpp:802
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
Definition: qbrush.cpp:1504
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
qint64 cacheKey() const
Returns a number that identifies this QPixmap.
Definition: qpixmap.cpp:1136
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615

◆ qBrushLight()

static QBrush qBrushLight ( QBrush  brush,
int  light 
)
static

Definition at line 516 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().

517 {
518  if (const QGradient *gradient = brush.gradient()) {
519  // Use the gradient. Call QColor::lighter() on all color stops.
520  QGradientStops stops = gradient->stops();
521  QMutableVectorIterator<QGradientStop> it(stops);
522  while (it.hasNext()) {
523  it.next();
524  it.setValue(QPair<qreal, QColor>(it.value().first, it.value().second.lighter(light)));
525  }
526 
527  switch (gradient->type()) {
529  QRadialGradient grad = *static_cast<const QRadialGradient *>(gradient);
530  grad.setStops(stops);
531  brush = QBrush(grad);
532  break;
533  }
535  QConicalGradient grad = *static_cast<const QConicalGradient *>(gradient);
536  grad.setStops(stops);
537  brush = QBrush(grad);
538  break;
539  }
540  default:
541  qWarning("QPlastiqueStyle::qBrushLight() - unknown gradient type"
542  " - falling back to QLinearGradient");
544  QLinearGradient grad = *static_cast<const QLinearGradient *>(gradient);
545  grad.setStops(stops);
546  brush = QBrush(grad);
547  break;
548  }
549  }
550  } else if (!brush.texture().isNull()) {
551  // Modify the texture - ridiculously expensive.
552  QPixmap texture = brush.texture();
553  QPixmap pixmap;
554  QString name = QLatin1Literal("qbrushtexture-light")
555  % HexString<int>(light)
556  % HexString<qint64>(texture.cacheKey());
557 
558  if (!QPixmapCache::find(name, pixmap)) {
559  QImage image = texture.toImage();
560  QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
561  int pixels = image.width() * image.height();
562  QColor tmpColor;
563  while (pixels--) {
564  tmpColor.setRgb(*rgb);
565  *rgb++ = tmpColor.lighter(light).rgba();
566  }
567  pixmap = QPixmap::fromImage(image);
568  QPixmapCache::insert(name, pixmap);
569  }
570  brush.setTexture(pixmap);
571  } else {
572  // Use the color
573  brush.setColor(brush.color().lighter(light));
574  }
575  return brush;
576 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setRgb(int r, int g, int b, int a=255)
Sets the RGB value to r, g, b and the alpha value to a.
Definition: qcolor.cpp:980
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
unsigned int QRgb
Definition: qrgb.h:53
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
#define it(className, varName)
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
Definition: qbrush.h:329
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
Definition: qbrush.h:297
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QPixmap * find(const QString &key)
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
void setColor(const QColor &color)
Sets the brush color to the given color.
Definition: qbrush.cpp:725
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
void setTexture(const QPixmap &pixmap)
Sets the brush pixmap to pixmap.
Definition: qbrush.cpp:802
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
Definition: qbrush.cpp:1504
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
qint64 cacheKey() const
Returns a number that identifies this QPixmap.
Definition: qpixmap.cpp:1136
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
Definition: qcolor.h:298

◆ qBrushSetAlphaF()

static void qBrushSetAlphaF ( QBrush brush,
qreal  alpha 
)
static

Definition at line 450 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStylePrivate::drawPartialFrame(), QPlastiqueStyle::drawPrimitive(), and qt_plastique_draw_frame().

451 {
452  if (const QGradient *gradient = brush->gradient()) {
453  // Use the gradient. Call QColor::setAlphaF() on all color stops.
454  QGradientStops stops = gradient->stops();
455  QMutableVectorIterator<QGradientStop> it(stops);
456  QColor tmpColor;
457  while (it.hasNext()) {
458  it.next();
459  tmpColor = it.value().second;
460  tmpColor.setAlphaF(alpha * tmpColor.alphaF());
461  it.setValue(QPair<qreal, QColor>(it.value().first, tmpColor));
462  }
463 
464  switch (gradient->type()) {
466  QRadialGradient grad = *static_cast<const QRadialGradient *>(gradient);
467  grad.setStops(stops);
468  *brush = QBrush(grad);
469  break;
470  }
472  QConicalGradient grad = *static_cast<const QConicalGradient *>(gradient);
473  grad.setStops(stops);
474  *brush = QBrush(grad);
475  break;
476  }
477  default:
478  qWarning("QPlastiqueStyle::qBrushLight() - unknown gradient type"
479  " - falling back to QLinearGradient");
481  QLinearGradient grad = *static_cast<const QLinearGradient *>(gradient);
482  grad.setStops(stops);
483  *brush = QBrush(grad);
484  break;
485  }
486  }
487  } else if (!brush->texture().isNull()) {
488  // Modify the texture - ridiculously expensive.
489  QPixmap texture = brush->texture();
490  QPixmap pixmap;
491  QString name = QLatin1Literal("qbrushtexture-alpha")
492  % HexString<qreal>(alpha)
493  % HexString<qint64>(texture.cacheKey());
494  if (!QPixmapCache::find(name, pixmap)) {
495  QImage image = texture.toImage();
496  QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
497  int pixels = image.width() * image.height();
498  QColor tmpColor;
499  while (pixels--) {
500  tmpColor.setRgb(*rgb);
501  tmpColor.setAlphaF(alpha * tmpColor.alphaF());
502  *rgb++ = tmpColor.rgba();
503  }
504  pixmap = QPixmap::fromImage(image);
505  QPixmapCache::insert(name, pixmap);
506  }
507  brush->setTexture(pixmap);
508  } else {
509  // Use the color
510  QColor tmpColor = brush->color();
511  tmpColor.setAlphaF(alpha * tmpColor.alphaF());
512  brush->setColor(tmpColor);
513  }
514 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setRgb(int r, int g, int b, int a=255)
Sets the RGB value to r, g, b and the alpha value to a.
Definition: qcolor.cpp:980
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
unsigned int QRgb
Definition: qrgb.h:53
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
#define it(className, varName)
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
Definition: qbrush.h:329
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
Definition: qbrush.h:297
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QPixmap * find(const QString &key)
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
void setColor(const QColor &color)
Sets the brush color to the given color.
Definition: qbrush.cpp:725
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
void setTexture(const QPixmap &pixmap)
Sets the brush pixmap to pixmap.
Definition: qbrush.cpp:802
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
Definition: qcolor.cpp:1117
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
Definition: qbrush.cpp:1504
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
qint64 cacheKey() const
Returns a number that identifies this QPixmap.
Definition: qpixmap.cpp:1136
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615

◆ qMapBrushToRect()

static QBrush qMapBrushToRect ( const QBrush brush,
const QRectF rect 
)
static

Definition at line 440 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().

441 {
442  if (!brush.gradient())
443  return brush;
444 
445  // ### Ugly assumption that it's a linear gradient
446  QBrush tmp(qMapGradientToRect(*static_cast<const QLinearGradient *>(brush.gradient()), rect));
447  return tmp;
448 }
static QLinearGradient qMapGradientToRect(const QLinearGradient &gradient, const QRectF &rect)
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76

◆ qMapGradientToRect()

static QLinearGradient qMapGradientToRect ( const QLinearGradient gradient,
const QRectF rect 
)
static

Definition at line 432 of file qplastiquestyle.cpp.

Referenced by qMapBrushToRect().

433 {
434  QLinearGradient tmpGrad(rect.center().x(), rect.top(),
435  rect.center().x(), rect.bottom());
436  tmpGrad.setStops(gradient.stops());
437  return tmpGrad;
438 }
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QGradientStops stops() const
Returns the stop points for this gradient.
Definition: qbrush.cpp:1520
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
Definition: qbrush.cpp:1504
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
QPointF center() const
Returns the center point of the rectangle.
Definition: qrect.h:686

◆ qt_plastique_draw_frame()

static void qt_plastique_draw_frame ( QPainter painter,
const QRect rect,
const QStyleOption option,
QFrame::Shadow  shadow = QFrame::Plain 
)
static

Definition at line 652 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), and QPlastiqueStyle::drawPrimitive().

654 {
655  QPen oldPen = painter->pen();
656  QBrush border;
657  QBrush corner;
658  QBrush innerTopLeft;
659  QBrush innerBottomRight;
660 
661  if (shadow != QFrame::Plain && (option->state & QStyle::State_HasFocus)) {
662  border = option->palette.highlight();
663  qBrushSetAlphaF(&border, qreal(0.8));
664  corner = option->palette.highlight();
665  qBrushSetAlphaF(&corner, 0.5);
666  innerTopLeft = qBrushDark(option->palette.highlight(), 125);
667  innerBottomRight = option->palette.highlight();
668  qBrushSetAlphaF(&innerBottomRight, qreal(0.65));
669  } else {
670  border = option->palette.shadow();
671  qBrushSetAlphaF(&border, qreal(0.4));
672  corner = option->palette.shadow();
673  qBrushSetAlphaF(&corner, 0.25);
674  innerTopLeft = option->palette.shadow();
675  innerBottomRight = option->palette.shadow();
676  if (shadow == QFrame::Sunken) {
677  qBrushSetAlphaF(&innerTopLeft, qreal(0.23));
678  qBrushSetAlphaF(&innerBottomRight, qreal(0.075));
679  } else {
680  qBrushSetAlphaF(&innerTopLeft, qreal(0.075));
681  qBrushSetAlphaF(&innerBottomRight, qreal(0.23));
682  }
683  }
684 
685  QLine lines[4];
686  QPoint points[8];
687 
688  // Opaque corner lines
689  painter->setPen(QPen(border, 0));
690  lines[0] = QLine(rect.left() + 2, rect.top(), rect.right() - 2, rect.top());
691  lines[1] = QLine(rect.left() + 2, rect.bottom(), rect.right() - 2, rect.bottom());
692  lines[2] = QLine(rect.left(), rect.top() + 2, rect.left(), rect.bottom() - 2);
693  lines[3] = QLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 2);
694  painter->drawLines(lines, 4);
695 
696  // Opaque corner dots
697  points[0] = QPoint(rect.left() + 1, rect.top() + 1);
698  points[1] = QPoint(rect.left() + 1, rect.bottom() - 1);
699  points[2] = QPoint(rect.right() - 1, rect.top() + 1);
700  points[3] = QPoint(rect.right() - 1, rect.bottom() - 1);
701  painter->drawPoints(points, 4);
702 
703  // Shaded corner dots
704  painter->setPen(QPen(corner, 0));
705  points[0] = QPoint(rect.left(), rect.top() + 1);
706  points[1] = QPoint(rect.left(), rect.bottom() - 1);
707  points[2] = QPoint(rect.left() + 1, rect.top());
708  points[3] = QPoint(rect.left() + 1, rect.bottom());
709  points[4] = QPoint(rect.right(), rect.top() + 1);
710  points[5] = QPoint(rect.right(), rect.bottom() - 1);
711  points[6] = QPoint(rect.right() - 1, rect.top());
712  points[7] = QPoint(rect.right() - 1, rect.bottom());
713  painter->drawPoints(points, 8);
714 
715  // Shadows
716  if (shadow != QFrame::Plain) {
717  painter->setPen(QPen(innerTopLeft, 0));
718  lines[0] = QLine(rect.left() + 2, rect.top() + 1, rect.right() - 2, rect.top() + 1);
719  lines[1] = QLine(rect.left() + 1, rect.top() + 2, rect.left() + 1, rect.bottom() - 2);
720  painter->drawLines(lines, 2);
721  painter->setPen(QPen(innerBottomRight, 0));
722  lines[0] = QLine(rect.left() + 2, rect.bottom() - 1, rect.right() - 2, rect.bottom() - 1);
723  lines[1] = QLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2);
724  painter->drawLines(lines, 2);
725  }
726 
727  painter->setPen(oldPen);
728 }
const QBrush & highlight() const
Returns the highlight brush of the current color group.
Definition: qpalette.h:140
static QBrush qBrushDark(QBrush brush, int dark)
double qreal
Definition: qglobal.h:1193
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen&#39;s color.
Definition: qpainter.cpp:3816
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
Definition: qpainter.cpp:4873
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
const QBrush & shadow() const
Returns the shadow brush of the current color group.
Definition: qpalette.h:139
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
static void qBrushSetAlphaF(QBrush *brush, qreal alpha)

◆ qt_plastique_draw_gradient()

static void qt_plastique_draw_gradient ( QPainter painter,
const QRect rect,
const QColor gradientStart,
const QColor gradientStop 
)
static

Definition at line 740 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), qt_plastique_draw_mdibutton(), and qt_plastique_drawShadedPanel().

742 {
743  QString gradientName = QLatin1Literal("qplastique-g")
744  % HexString<int>(rect.width())
745  % HexString<int>(rect.height())
746  % HexString<QRgb>(gradientStart.rgba())
747  % HexString<QRgb>(gradientStop.rgba());
748 
749  QPixmap cache;
750  QPainter *p = painter;
751  QRect r = rect;
752 
753  bool doPixmapCache = painter->deviceTransform().isIdentity()
754  && painter->worldMatrix().isIdentity();
755  if (doPixmapCache && QPixmapCache::find(gradientName, cache)) {
756  painter->drawPixmap(rect, cache);
757  } else {
758  if (doPixmapCache) {
759  cache = QPixmap(rect.size());
760  cache.fill(Qt::transparent);
761  p = new QPainter(&cache);
762  r = QRect(0, 0, rect.width(), rect.height());
763  }
764 
765  int x = r.center().x();
766  QLinearGradient gradient(x, r.top(), x, r.bottom());
767  gradient.setColorAt(0, gradientStart);
768  gradient.setColorAt(1, gradientStop);
769  p->fillRect(r, gradient);
770 
771  if (doPixmapCache) {
772  p->end();
773  delete p;
774  painter->drawPixmap(rect, cache);
775  QPixmapCache::insert(gradientName, cache);
776  }
777  }
778 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
Definition: qbrush.cpp:1475
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QPixmap * find(const QString &key)
bool isIdentity() const
Returns true if the matrix is the identity matrix, otherwise returns false.
Definition: qtransform.h:204
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const QTransform & deviceTransform() const
Returns the matrix that transforms from logical coordinates to device coordinates of the platform dep...
Definition: qpainter.cpp:9579
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
bool isIdentity() const
Returns true if the matrix is the identity matrix, otherwise returns false.
Definition: qmatrix.h:166
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
const QMatrix & worldMatrix() const
Returns the world transformation matrix.
Definition: qpainter.cpp:3024
bool end()
Ends painting.
Definition: qpainter.cpp:1929
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420

◆ qt_plastique_draw_handle()

static void qt_plastique_draw_handle ( QPainter painter,
const QStyleOption option,
const QRect rect,
Qt::Orientation  orientation,
const QWidget widget 
)
static

Definition at line 951 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().

954 {
955  QColor borderColor = option->palette.background().color().darker(178);
956  QColor alphaCornerColor;
957  if (widget) {
958  // ### backgroundrole/foregroundrole should be part of the style option
959  alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), borderColor);
960  } else {
961  alphaCornerColor = mergedColors(option->palette.background().color(), borderColor);
962  }
964  alphaCornerColor.setAlpha(170);
965  handle.setColor(1, alphaCornerColor.rgba());
966  handle.setColor(2, mergedColors(alphaCornerColor, option->palette.light().color()).rgba());
967  handle.setColor(3, option->palette.light().color().rgba());
968 
969  const int spacing = 2;
970 
971  if (orientation == Qt::Vertical) {
972  int nchunks = rect.width() / (handle.width() + spacing);
973  for (int i = 0; i < nchunks; ++i)
974  painter->drawImage(QPoint(rect.left() + i * (handle.width() + spacing), rect.top()), handle);
975  } else {
976  int nchunks = rect.height() / (handle.height() + spacing);
977  for (int i = 0; i < nchunks; ++i)
978  painter->drawImage(QPoint(rect.left(), rect.top() + i * (handle.height() + spacing)), handle);
979  }
980 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor=50)
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
const QBrush & background() const
Use window() instead.
Definition: qpalette.h:134
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QPalette::ColorRole backgroundRole() const
Returns the background role of the widget.
Definition: qwidget.cpp:4677
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
static const char *const qt_simple_toolbarhandle[]
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
const QBrush & light() const
Returns the light brush of the current color group.
Definition: qpalette.h:126
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
Definition: qcolor.cpp:1094
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Definition: qpainter.cpp:5936
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019

◆ qt_plastique_draw_mdibutton()

static void qt_plastique_draw_mdibutton ( QPainter painter,
const QStyleOptionTitleBar option,
const QRect tmp,
bool  hover,
bool  sunken 
)
static

Definition at line 874 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl().

875 {
876  if (tmp.isNull())
877  return;
878  bool active = (option->titleBarState & QStyle::State_Active);
879 
880  // ### use palette colors instead
881  QColor mdiButtonGradientStartColor;
882  QColor mdiButtonGradientStopColor;
883  if (active) {
884  mdiButtonGradientStartColor = QColor((hover || sunken) ? 0x7d8bb1 : 0x55689a);
885  mdiButtonGradientStopColor = QColor((hover || sunken) ? 0x939ebe : 0x7381ab);
886  } else {
887  mdiButtonGradientStartColor = QColor((hover || sunken) ? 0x9e9e9e : 0x818181);
888  mdiButtonGradientStopColor = QColor((hover || sunken) ? 0xababab : 0x929292);
889  }
890 
891  qt_plastique_draw_gradient(painter, tmp.adjusted(1, 1, -1, -1),
892  mdiButtonGradientStartColor, mdiButtonGradientStopColor);
893 
894  QColor mdiButtonBorderColor;
895  if (active) {
896  mdiButtonBorderColor = (hover || sunken) ? QColor(0x627097) : QColor(0x324577);
897  } else {
898  mdiButtonBorderColor = (hover || sunken) ? QColor(0x838383) : QColor(0x5e5e5e);
899  }
900  painter->setPen(QPen(mdiButtonBorderColor, 1));
901 
902  const QLine lines[4] = {
903  QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
904  QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
905  QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
906  QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2) };
907  painter->drawLines(lines, 4);
908 
909  const QPoint points[4] = {
910  QPoint(tmp.left() + 1, tmp.top() + 1),
911  QPoint(tmp.right() - 1, tmp.top() + 1),
912  QPoint(tmp.left() + 1, tmp.bottom() - 1),
913  QPoint(tmp.right() - 1, tmp.bottom() - 1) };
914  painter->drawPoints(points, 4);
915 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen&#39;s color.
Definition: qpainter.cpp:3816
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
Definition: qpainter.cpp:4873
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop)
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
int titleBarState
the state of the title bar
Definition: qstyleoption.h:824

◆ qt_plastique_drawFrame()

static void qt_plastique_drawFrame ( QPainter painter,
const QStyleOption option,
const QWidget widget 
)
static

Definition at line 780 of file qplastiquestyle.cpp.

Referenced by qt_plastique_drawShadedPanel().

781 {
782  QRect rect = option->rect;
783  QPen oldPen = painter->pen();
784 
785  QColor borderColor = option->palette.background().color().darker(178);
786  QColor gradientStartColor = option->palette.button().color().lighter(104);
787  QColor gradientStopColor = option->palette.button().color().darker(105);
788  QColor alphaCornerColor;
789  if (widget) {
790  // ### backgroundrole/foregroundrole should be part of the style option
791  alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), borderColor);
792  } else {
793  alphaCornerColor = mergedColors(option->palette.background().color(), borderColor);
794  }
795 
796  QLine lines[4];
797  QPoint points[8];
798 
799  // outline / border
800  painter->setPen(borderColor);
801  lines[0] = QLine(rect.left() + 2, rect.top(), rect.right() - 2, rect.top());
802  lines[1] = QLine(rect.left() + 2, rect.bottom(), rect.right() - 2, rect.bottom());
803  lines[2] = QLine(rect.left(), rect.top() + 2, rect.left(), rect.bottom() - 2);
804  lines[3] = QLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 2);
805  painter->drawLines(lines, 4);
806 
807  points[0] = QPoint(rect.left() + 1, rect.top() + 1);
808  points[1] = QPoint(rect.right() - 1, rect.top() + 1);
809  points[2] = QPoint(rect.left() + 1, rect.bottom() - 1);
810  points[3] = QPoint(rect.right() - 1, rect.bottom() - 1);
811  painter->drawPoints(points, 4);
812 
813  painter->setPen(alphaCornerColor);
814 
815  points[0] = QPoint(rect.left() + 1, rect.top());
816  points[1] = QPoint(rect.right() - 1, rect.top());
817  points[2] = QPoint(rect.left() + 1, rect.bottom());
818  points[3] = QPoint(rect.right() - 1, rect.bottom());
819  points[4] = QPoint(rect.left(), rect.top() + 1);
820  points[5] = QPoint(rect.right(), rect.top() + 1);
821  points[6] = QPoint(rect.left(), rect.bottom() - 1);
822  points[7] = QPoint(rect.right(), rect.bottom() - 1);
823  painter->drawPoints(points, 8);
824 
825  // inner border
826  if ((option->state & QStyle::State_Sunken) || (option->state & QStyle::State_On))
827  painter->setPen(option->palette.button().color().darker(118));
828  else
829  painter->setPen(gradientStartColor);
830 
831  lines[0] = QLine(rect.left() + 2, rect.top() + 1, rect.right() - 2, option->rect.top() + 1);
832  lines[1] = QLine(rect.left() + 1, rect.top() + 2, rect.left() + 1, option->rect.bottom() - 2);
833  painter->drawLines(lines, 2);
834 
835  if ((option->state & QStyle::State_Sunken) || (option->state & QStyle::State_On))
836  painter->setPen(option->palette.button().color().darker(110));
837  else
838  painter->setPen(gradientStopColor.darker(102));
839 
840  lines[0] = QLine(rect.left() + 2, rect.bottom() - 1, rect.right() - 2, rect.bottom() - 1);
841  lines[1] = QLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2);
842  painter->drawLines(lines, 2);
843 
844  painter->setPen(oldPen);
845 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor=50)
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen&#39;s color.
Definition: qpainter.cpp:3816
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
const QBrush & background() const
Use window() instead.
Definition: qpalette.h:134
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
QPalette::ColorRole backgroundRole() const
Returns the background role of the widget.
Definition: qwidget.cpp:4677
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
Definition: qpainter.cpp:4873
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
Definition: qcolor.h:298
const QBrush & button() const
Returns the button brush of the current color group.
Definition: qpalette.h:125
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ qt_plastique_drawShadedPanel()

static void qt_plastique_drawShadedPanel ( QPainter painter,
const QStyleOption option,
bool  base,
const QWidget widget 
)
static

Definition at line 847 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().

849 {
850  QRect rect = option->rect;
851  QPen oldPen = painter->pen();
852 
853  QColor gradientStartColor = option->palette.button().color().lighter(104);
854  QColor gradientStopColor = option->palette.button().color().darker(105);
855 
856  // gradient fill
857  if ((option->state & QStyle::State_Enabled) || !(option->state & QStyle::State_AutoRaise)) {
858  if ((option->state & QStyle::State_Sunken) || (option->state & QStyle::State_On)) {
859  qt_plastique_draw_gradient(painter, rect.adjusted(1, 1, -1, -1),
860  option->palette.button().color().darker(114),
861  option->palette.button().color().darker(106));
862  } else {
863  qt_plastique_draw_gradient(painter, rect.adjusted(1, 1, -1, -1),
864  base ? option->palette.background().color().lighter(105) : gradientStartColor,
865  base ? option->palette.background().color().darker(102) : gradientStopColor);
866  }
867  }
868 
869  qt_plastique_drawFrame(painter, option, widget);
870 
871  painter->setPen(oldPen);
872 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
static void qt_plastique_drawFrame(QPainter *painter, const QStyleOption *option, const QWidget *widget)
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
const QBrush & background() const
Use window() instead.
Definition: qpalette.h:134
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
static const uint base
Definition: qurl.cpp:268
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop)
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
Definition: qcolor.h:298
const QBrush & button() const
Returns the button brush of the current color group.
Definition: qpalette.h:125
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

Variable Documentation

◆ AnimateBusyProgressBar

const bool AnimateBusyProgressBar = true
static

◆ AnimateProgressBar

const bool AnimateProgressBar = false
static

◆ blueFrameWidth

const int blueFrameWidth = 2
static

◆ ProgressBarFps

const int ProgressBarFps = 25
static

◆ qt_plastique_slider_horizontalhandle

const char* const qt_plastique_slider_horizontalhandle[]
static
Initial value:
= {
"11 15 6 1",
" c None",
"+ c #979797",
"@ c #C9C9C9",
"$ c #C1C1C1",
"b c None",
"d c None",
" $+++++++$ ",
"$+bbbbbbb+$",
"+b d+",
"+b$$ $$d+",
"+b$@ $@d+",
"+b d+",
"+b d+",
"+b d+",
"+b d+",
"+b d+",
"$+ d+$",
" $+ d+$ ",
" $+ d+$ ",
" $+d+$ ",
" $+$ "}

Definition at line 144 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl().

◆ qt_plastique_slider_horizontalhandle_up

const char* const qt_plastique_slider_horizontalhandle_up[]
static
Initial value:
= {
"11 15 6 1",
" c None",
"+ c #979797",
"@ c #C9C9C9",
"$ c #C1C1C1",
"b c None",
"d c None",
" $+$ ",
" $+b+$ ",
" $+b +$ ",
" $+b +$ ",
"$+b +$",
"+b d+",
"+b d+",
"+b d+",
"+b d+",
"+b d+",
"+b$$ $$d+",
"+b$@ $@d+",
"+b d+",
"$+ddddddd+$",
" $+++++++$ "}

Definition at line 168 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl().

◆ qt_plastique_slider_verticalhandle

const char* const qt_plastique_slider_verticalhandle[]
static
Initial value:
= {
"15 11 6 1",
" c None",
"+ c #979797",
"@ c #C9C9C9",
"$ c #C1C1C1",
"b c None",
"d c None",
" $++++++++$ ",
"$+bbbbbbbb+$ ",
"+b $$ +$ ",
"+b $@ +$ ",
"+b +$",
"+b d+",
"+b d+$",
"+b $$ d+$ ",
"+b $@ d+$ ",
"$+dddddddd+$ ",
" $++++++++$ "}

Definition at line 104 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl().

◆ qt_plastique_slider_verticalhandle_left

const char* const qt_plastique_slider_verticalhandle_left[]
static
Initial value:
= {
"15 11 6 1",
" c None",
"+ c #979797",
"@ c #C9C9C9",
"$ c #C1C1C1",
"b c None",
"d c None",
" $++++++++$ ",
" $+bbbbbbbb+$",
" $+b $$ d+",
" $+b $@ d+",
"$+b d+",
"+b d+",
"$+ d+",
" $+ $$ d+",
" $+ $@ d+",
" $+dddddddd+$",
" $++++++++$ "}

Definition at line 124 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl().

◆ qt_scrollbar_button_arrow_down

const char* const qt_scrollbar_button_arrow_down[]
static
Initial value:
= {
"7 4 2 1",
" c None",
"* c #BFBFBF",
"*******",
" ***** ",
" *** ",
" * "}

Definition at line 225 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_arrow_left

const char* const qt_scrollbar_button_arrow_left[]
static
Initial value:
= {
"4 7 2 1",
" c None",
"* c #BFBFBF",
" *",
" **",
" ***",
"****",
" ***",
" **",
" *"}

Definition at line 192 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_arrow_right

const char* const qt_scrollbar_button_arrow_right[]
static
Initial value:
= {
"4 7 2 1",
" c None",
"* c #BFBFBF",
"* ",
"** ",
"*** ",
"****",
"*** ",
"** ",
"* "}

Definition at line 204 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_arrow_up

const char* const qt_scrollbar_button_arrow_up[]
static
Initial value:
= {
"7 4 2 1",
" c None",
"* c #BFBFBF",
" * ",
" *** ",
" ***** ",
"*******"}

Definition at line 216 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_down

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 309 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_left

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 234 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_right

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 259 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_button_up

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 284 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_slider_pattern_horizontal

const char* const qt_scrollbar_slider_pattern_horizontal[]
static
Initial value:
= {
"18 10 3 1",
" c None",
". c #BFBFBF",
"+ c #979797",
".. .. .. .. ..",
".+ .+ .+ .+ .+",
" ",
" ",
".. .. .. .. ..",
".+ .+ .+ .+ .+",
" ",
" ",
".. .. .. .. ..",
".+ .+ .+ .+ .+"}

Definition at line 358 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_scrollbar_slider_pattern_vertical

const char* const qt_scrollbar_slider_pattern_vertical[]
static
Initial value:
= {
"10 18 3 1",
" c None",
". c #BFBFBF",
"+ c #979797",
".. .. ..",
".+ .+ .+",
" ",
" ",
".. .. ..",
".+ .+ .+",
" ",
" ",
".. .. ..",
".+ .+ .+",
" ",
" ",
".. .. ..",
".+ .+ .+",
" ",
" ",
".. .. ..",
".+ .+ .+"}

Definition at line 334 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ qt_simple_toolbarhandle

const char* const qt_simple_toolbarhandle[]
static
Initial value:
= {
"3 3 4 1",
" c None",
". c #C5C5C5",
"+ c #EEEEEE",
"@ c #FAFAFA",
".. ",
".+@",
" @@"}

Definition at line 387 of file qplastiquestyle.cpp.

Referenced by qt_plastique_draw_handle().

◆ qt_titlebar_context_help

const char* const qt_titlebar_context_help[]
static

Definition at line 397 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawComplexControl().

◆ qt_toolbarhandle

const char* const qt_toolbarhandle[]
static
Initial value:
= {
"6 6 4 1",
" c None",
". c #C5C5C5",
"+ c #EEEEEE",
"@ c #FAFAFA",
".. ",
".+@ ",
" @@ ",
" .. ",
" .+@",
" @@"}

Definition at line 374 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl(), and QPlastiqueStyle::drawPrimitive().

◆ windowsArrowHMargin

const int windowsArrowHMargin = 6
static

Definition at line 99 of file qplastiquestyle.cpp.

◆ windowsCheckMarkWidth

const int windowsCheckMarkWidth = 12
static

Definition at line 102 of file qplastiquestyle.cpp.

◆ windowsItemFrame

const int windowsItemFrame = 2
static

Definition at line 95 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ windowsItemHMargin

const int windowsItemHMargin = 3
static

Definition at line 97 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ windowsItemVMargin

const int windowsItemVMargin = 2
static

Definition at line 98 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ windowsRightBorder

const int windowsRightBorder = 15
static

Definition at line 101 of file qplastiquestyle.cpp.

Referenced by QPlastiqueStyle::drawControl().

◆ windowsSepHeight

const int windowsSepHeight = 2
static

Definition at line 96 of file qplastiquestyle.cpp.

◆ windowsTabSpacing

const int windowsTabSpacing = 12
static

Definition at line 100 of file qplastiquestyle.cpp.