summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qplastiquestyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles/qplastiquestyle.cpp')
-rw-r--r--src/gui/styles/qplastiquestyle.cpp178
1 files changed, 89 insertions, 89 deletions
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index 24d7748..725e1d5 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -43,7 +43,6 @@
#if !defined(QT_NO_STYLE_PLASTIQUE) || defined(QT_PLUGIN)
-static bool UsePixmapCache = true;
static const bool AnimateBusyProgressBar = true;
static const bool AnimateProgressBar = false;
// #define QPlastique_MaskButtons
@@ -51,6 +50,7 @@ static const int ProgressBarFps = 25;
static const int blueFrameWidth = 2; // with of line edit focus frame
#include "qwindowsstyle_p.h"
+#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
#include <qabstractitemview.h>
@@ -490,7 +490,7 @@ static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
QPixmap texture = brush->texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -551,7 +551,7 @@ static QBrush qBrushLight(QBrush brush, int light)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -610,7 +610,7 @@ static QBrush qBrushDark(QBrush brush, int dark)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -749,8 +749,7 @@ static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, con
QPainter *p = painter;
QRect r = rect;
- bool doPixmapCache = UsePixmapCache
- && painter->deviceTransform().isIdentity()
+ bool doPixmapCache = painter->deviceTransform().isIdentity()
&& painter->worldMatrix().isIdentity();
if (doPixmapCache && QPixmapCache::find(gradientName, cache)) {
painter->drawPixmap(rect, cache);
@@ -1005,8 +1004,6 @@ QPlastiqueStylePrivate::QPlastiqueStylePrivate() :
, progressBarAnimateTimer(0)
#endif
{
- if (!qgetenv("QT_STYLE_NO_PIXMAPCACHE").isNull())
- UsePixmapCache = false;
}
/*!
@@ -1132,7 +1129,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
switch (element) {
case PE_IndicatorButtonDropDown:
- drawPrimitive(PE_PanelButtonTool, option, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, option, painter, widget);
break;
case PE_FrameDefaultButton: {
if (!(option->state & QStyle::State_Enabled))
@@ -1178,7 +1175,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
break;
}
- int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget);
+ int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget);
bool reverse = (twf->direction == Qt::RightToLeft);
painter->save();
@@ -1357,7 +1354,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->setPen(oldPen);
} else {
frameV2.state &= ~(State_Sunken | State_HasFocus);
- drawPrimitive(PE_Frame, &frameV2, painter, widget);
+ proxy()->drawPrimitive(PE_Frame, &frameV2, painter, widget);
}
}
break;
@@ -1516,7 +1513,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
}
#endif
QString pixmapName = uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -1546,8 +1543,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
handle);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(rect.topLeft(), cache);
break;
@@ -1857,13 +1853,13 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
QStyleOptionButton button;
button.QStyleOption::operator=(*option);
button.state &= ~State_MouseOver;
- drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
break;
}
case PE_FrameWindow: {
painter->save();
bool active = (option->state & State_Active);
- int titleBarStop = option->rect.top() + pixelMetric(PM_TitleBarHeight, option, widget);
+ int titleBarStop = option->rect.top() + proxy()->pixelMetric(PM_TitleBarHeight, option, widget);
QPalette palette = option->palette;
if (!active)
@@ -2073,7 +2069,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
&& !leftCornerWidget;
bool reverseShadow = false;
- int borderThickness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
+ int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
int marginLeft = 0;
if ((atBeginning && !selected) || (selected && leftCornerWidget && ((tab->position == QStyleOptionTab::Beginning) || onlyTab))) {
marginLeft = 1;
@@ -2785,7 +2781,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString progressBarName = uniqueName(QLatin1String("progressBarContents"),
option, rect.size());
QPixmap cache;
- if ((!UsePixmapCache || !QPixmapCache::find(progressBarName, cache)) && rect.height() > 7) {
+ if (!QPixmapCache::find(progressBarName, cache) && rect.height() > 7) {
QSize size = rect.size();
cache = QPixmap(QSize(size.width() - 6 + 30, size.height() - 6));
cache.fill(Qt::white);
@@ -2818,8 +2814,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
leftEdge += 10;
}
- if (UsePixmapCache)
- QPixmapCache::insert(progressBarName, cache);
+ QPixmapCache::insert(progressBarName, cache);
}
painter->setClipRect(progressBar.adjusted(1, 0, -1, -1));
@@ -2844,10 +2839,10 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
QPixmap cache;
QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
- pixmapName += QLatin1String("-") + QString::number(int(header->position));
- pixmapName += QLatin1String("-") + QString::number(int(header->orientation));
+ pixmapName += QString::number(- int(header->position));
+ pixmapName += QString::number(- int(header->orientation));
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -2891,8 +2886,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
@@ -2915,7 +2909,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
int w = 0;
if (!menuItem->text.isEmpty()) {
painter->setFont(menuItem->font);
- drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
+ proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
QPalette::Text);
w = menuItem->fontMetrics.width(menuItem->text) + 5;
@@ -2958,7 +2952,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if (checked)
button.state |= State_On;
button.palette = menuItem->palette;
- drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget);
} else {
if (menuItem->icon.isNull()) {
QStyleOptionButton button;
@@ -2967,7 +2961,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if (checked)
button.state |= State_On;
button.palette = menuItem->palette;
- drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
} else if (checked) {
int iconSize = qMax(menuItem->maxIconWidth, 20);
QRect sunkenRect(option->rect.left() + 1,
@@ -3079,7 +3073,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
newMI.palette.highlightedText().color());
else
newMI.palette.setColor(QPalette::ButtonText, textBrush.color());
- drawPrimitive(arrow, &newMI, painter, widget);
+ proxy()->drawPrimitive(arrow, &newMI, painter, widget);
}
painter->restore();
@@ -3092,7 +3086,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if ((option->state & State_Selected)) {
QPixmap cache;
QString pixmapName = uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -3142,8 +3136,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
lines[1] = QLine(rect.right() - 1, rect.top() + 1, rect.right() - 1, rect.bottom() - 2);
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
} else {
@@ -3457,7 +3450,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(addLinePixmapName, cache)) {
+ if (!QPixmapCache::find(addLinePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3516,8 +3509,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
addLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
addLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(addLinePixmapName, cache);
+ QPixmapCache::insert(addLinePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3535,7 +3527,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
groovePixmapName += QLatin1String("-addpage");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(option->palette.background().color());
QPainter groovePainter(&cache);
@@ -3561,8 +3553,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3579,7 +3570,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// The SubLine (up/left) buttons
QRect button1;
QRect button2;
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
+ int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
if (horizontal) {
button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height());
button2.setRect(scrollBarSubLine.right() - (scrollBarExtent - 1), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height());
@@ -3590,7 +3581,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString subLinePixmapName = uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(subLinePixmapName, cache)) {
+ if (!QPixmapCache::find(subLinePixmapName, cache)) {
cache = QPixmap(button1.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3650,8 +3641,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
subLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
subLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(subLinePixmapName, cache);
+ QPixmapCache::insert(subLinePixmapName, cache);
}
painter->drawPixmap(button1.topLeft(), cache);
painter->drawPixmap(button2.topLeft(), cache);
@@ -3669,7 +3659,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
sliderPixmapName += QLatin1String("-horizontal");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(sliderPixmapName, cache)) {
+ if (!QPixmapCache::find(sliderPixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3720,7 +3710,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
pixmapRect.right() - 1, pixmapRect.bottom() - 1);
sliderPainter.drawLines(lines, 2);
- int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
+ int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
if ((horizontal && scrollBar->rect.width() > sliderMinLength)
|| (!horizontal && scrollBar->rect.height() > sliderMinLength)) {
QImage pattern(horizontal ? qt_scrollbar_slider_pattern_horizontal
@@ -3740,8 +3730,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
sliderPainter.end();
// insert the slider into the cache
- if (UsePixmapCache)
- QPixmapCache::insert(sliderPixmapName, cache);
+ QPixmapCache::insert(sliderPixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3760,7 +3749,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QWindowsStyle::drawControl(element, option, painter, widget);
} else if (!comboBox->currentIcon.isNull()) {
{
- QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
+ QRect editRect = proxy()->subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
if (comboBox->direction == Qt::RightToLeft)
editRect.adjust(0, 2, -2, -2);
else
@@ -3777,7 +3766,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
Qt::AlignLeft | Qt::AlignVCenter,
iconRect.size(), editRect);
painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
+ proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
}
painter->restore();
}
@@ -3820,9 +3809,9 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect grooveRegion = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
+ QRect grooveRegion = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
+ QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
+ QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
@@ -3891,7 +3880,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
if ((option->activeSubControls & SC_SliderHandle) && (option->state & State_Sunken))
handlePixmapName += QLatin1String("-sunken");
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3974,8 +3963,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
handlePainter.drawImage(pixmapRect, image);
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
@@ -3984,15 +3972,15 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
}
if (option->subControls & SC_SliderTickmarks) {
QPen oldPen = painter->pen();
painter->setPen(borderColor);
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
int interval = slider->tickInterval;
if (interval <= 0) {
interval = slider->singleStep;
@@ -4006,7 +3994,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
interval = 1;
int v = slider->minimum;
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
QVarLengthArray<QLine, 32> lines;
while (v <= slider->maximum + 1) {
if (v == slider->maximum + 1 && interval == 1)
@@ -4061,8 +4049,8 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool reverse = (spinBox->direction == Qt::RightToLeft);
// Rects
- QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
- QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
+ QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
+ QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
QRect buttonRect = upRect | downRect;
// Brushes
@@ -4083,7 +4071,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
} else {
d->drawPartialFrame(painter,
option,
- subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget),
+ proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget),
widget);
}
// Paint buttons
@@ -4423,7 +4411,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
Q_D(const QPlastiqueStyle);
d->drawPartialFrame(painter,
option,
- subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget),
+ proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget),
widget);
QBrush border = qMapBrushToRect(option->palette.shadow(), buttonRect);
@@ -4547,7 +4535,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
if (!sunken) {
buttonOption.state &= ~State_Sunken;
}
- drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
// Draw the menu button separator line
QBrush border = qMapBrushToRect(option->palette.shadow(), rect);
@@ -4580,11 +4568,12 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
// Draw the focus rect
- if (((option->state & State_HasFocus) && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
+ if ((option->state & State_HasFocus) && !comboBox->editable
+ && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
QStyleOptionFocusRect focus;
- focus.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
+ focus.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
.adjusted(-2, 0, 2, 0);
- drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
}
painter->setPen(oldPen);
@@ -4614,7 +4603,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
QStyleOptionDockWidgetV2 dockwidget;
dockwidget.QStyleOption::operator=(*option);
dockwidget.title = titleBar->text;
- drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
+ proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
} else
#endif // QT3_SUPPORT
@@ -4687,7 +4676,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
}
// draw title
- QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
+ QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
QFont font = painter->font();
font.setBold(true);
@@ -4714,7 +4703,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
- QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
+ QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken);
int xoffset = minButtonRect.width() / 3;
@@ -4758,7 +4747,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
- QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
+ QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken);
int xoffset = maxButtonRect.width() / 3;
@@ -4783,7 +4772,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
- QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
+ QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
int xoffset = closeButtonRect.width() / 3;
@@ -4829,7 +4818,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
- QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
+ QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken);
int xoffset = int(normalButtonRect.width() / 3.5);
int yoffset = int(normalButtonRect.height() / 3.5);
@@ -4875,7 +4864,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
- QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
+ QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken);
@@ -4902,7 +4891,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
- QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
+ QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken);
int xoffset = shadeButtonRect.width() / 3;
@@ -4926,7 +4915,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
- QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
+ QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken);
int xoffset = unshadeButtonRect.width() / 3;
@@ -4951,7 +4940,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_Sunken);
- QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
+ QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
if (hover)
qt_plastique_draw_mdibutton(painter, titleBar, iconRect, hover, sunken);
@@ -4963,13 +4952,19 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
QPixmap pm = standardPixmap(SP_TitleBarMenuButton, &tool, widget);
tool.rect = iconRect;
painter->save();
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
painter->restore();
}
}
painter->restore();
}
break;
+#ifndef QT_NO_DIAL
+ case CC_Dial:
+ if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
+ QStyleHelper::drawDial(dial, painter);
+ break;
+#endif // QT_NO_DIAL
default:
QWindowsStyle::drawComplexControl(control, option, painter, widget);
break;
@@ -4992,7 +4987,7 @@ QSize QPlastiqueStyle::sizeFromContents(ContentsType type, const QStyleOption *o
#ifndef QT_NO_SLIDER
case CT_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
if (slider->tickPosition & QSlider::TicksBelow) {
if (slider->orientation == Qt::Horizontal)
newSize.rheight() += tickSize;
@@ -5011,8 +5006,8 @@ QSize QPlastiqueStyle::sizeFromContents(ContentsType type, const QStyleOption *o
#ifndef QT_NO_SCROLLBAR
case CT_ScrollBar:
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
- int scrollBarSliderMinimum = pixelMetric(PM_ScrollBarSliderMin, option, widget);
+ int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
+ int scrollBarSliderMinimum = proxy()->pixelMetric(PM_ScrollBarSliderMin, option, widget);
if (scrollBar->orientation == Qt::Horizontal) {
newSize = QSize(scrollBarExtent * 3 + scrollBarSliderMinimum, scrollBarExtent);
} else {
@@ -5093,7 +5088,7 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
switch (subControl) {
case SC_SliderHandle:
@@ -5146,10 +5141,10 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar, widget);
+ int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollBar, widget);
int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ?
scrollBar->rect.width() : scrollBar->rect.height()) - (scrollBarExtent * 3);
- int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
+ int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
int sliderLength;
// calculate slider length
@@ -5271,7 +5266,7 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption
break;
case SC_ComboBoxEditField: {
if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int frameWidth = pixelMetric(PM_DefaultFrameWidth);
+ int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
rect = visualRect(option->direction, option->rect, rect);
if (box->editable) {
@@ -5453,6 +5448,11 @@ int QPlastiqueStyle::styleHint(StyleHint hint, const QStyleOption *option, const
case SH_Menu_SubMenuPopupDelay:
ret = 96; // from Plastik
break;
+#ifndef Q_OS_WIN
+ case SH_Menu_AllowActiveAndDisabled:
+ ret = false;
+ break;
+#endif
default:
ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
break;
@@ -5471,31 +5471,31 @@ QStyle::SubControl QPlastiqueStyle::hitTestComplexControl(ComplexControl control
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect slider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
+ QRect slider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
if (slider.contains(pos)) {
ret = SC_ScrollBarSlider;
break;
}
- QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
+ QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
if (scrollBarAddLine.contains(pos)) {
ret = SC_ScrollBarAddLine;
break;
}
- QRect scrollBarSubPage = subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget);
+ QRect scrollBarSubPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget);
if (scrollBarSubPage.contains(pos)) {
ret = SC_ScrollBarSubPage;
break;
}
- QRect scrollBarAddPage = subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget);
+ QRect scrollBarAddPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget);
if (scrollBarAddPage.contains(pos)) {
ret = SC_ScrollBarAddPage;
break;
}
- QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
+ QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
if (scrollBarSubLine.contains(pos)) {
ret = SC_ScrollBarSubLine;
break;